Skip to content

Commit

Permalink
Merge pull request #223 from statikbe/173-seperate-or-differentiate-b…
Browse files Browse the repository at this point in the history
…etween-asset-caption-and-asset-alt-text-fields

173 seperate or differentiate between asset caption and asset alt text fields
  • Loading branch information
Numkil authored Dec 2, 2023
2 parents 8f6c5cb + b73c729 commit 85f60a7
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ columnSuffix: null
contentColumnType: text
fieldGroup: 2c770290-8edc-4f26-b846-6d99d36d7844 # Common
handle: imageCaption
instructions: ''
instructions: 'This will most likely be visible below the image'
name: 'Image Caption'
searchable: true
settings:
byteLimit: null
charLimit: null
code: ''
code: false
columnType: text
initialRows: '4'
multiline: ''
placeholder: 'description of the image'
initialRows: 4
multiline: false
placeholder: null
uiMode: normal
translationKeyFormat: null
translationMethod: site
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ columnSuffix: null
contentColumnType: text
fieldGroup: 2c770290-8edc-4f26-b846-6d99d36d7844 # Common
handle: imageCopyright
instructions: ''
instructions: 'Credit of the image'
name: 'Image Copyright'
searchable: true
settings:
byteLimit: null
charLimit: null
code: ''
code: false
columnType: null
initialRows: '4'
multiline: ''
placeholder: 'Credit of the image'
initialRows: 4
multiline: false
placeholder: null
uiMode: normal
translationKeyFormat: null
translationMethod: site
Expand Down
2 changes: 1 addition & 1 deletion config/project/project.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
dateModified: 1700754242
dateModified: 1700754763
elementSources:
craft\elements\Entry:
-
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,29 @@ fieldLayouts:
userCondition: null
warning: null
width: 100
-
attribute: alt
class: null
cols: null
disabled: false
elementCondition: null
id: null
instructions: null
label: null
name: null
orientation: null
placeholder: null
readonly: false
requirable: true
required: false
rows: null
tip: null
title: null
type: craft\fieldlayoutelements\assets\AltField
uid: 613a44f5-6a37-4c31-9640-88cb393cb476
userCondition: null
warning: null
width: 100
-
elementCondition: null
fieldUid: 39f07216-d49a-4917-b05e-bec26f425843 # Image Caption
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<img src="{{ optimizedImage.placeholderBox() }}"
srcset="{{ optimizedImage.srcset() }}"
sizes="(max-width: 479px) 95vw, (min-width: 480px) and (max-width: 659px) 448px, (min-width: 660px) and (max-width: 819px) 628px, (min-width: 820px) and (max-width: 979px) 378px, (min-width: 980px) and (max-width: 1199px) 458px, (min-width: 1200px) 568px"
alt="{{ image.imageCaption ?? image.title ?? entry.title }}"
alt="{{ image.alt }}"
class="sr-only js-bg-src" loading="lazy"/>
</picture>
</div>
Expand Down
4 changes: 2 additions & 2 deletions templates/_site/_snippet/_content/_blocks/_image.twig
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
{% endif %}
{% if image.extension == 'svg' or image.extension == 'gif' %}
<img src="{{ image.getUrl() }}"
alt="{{ image.imageCaption }}"
alt="{{ image.alt }}"
width="{{ image.width }}" height="{{ image.height }}"
class="w-full {% if block.showLargerVersionInPopup %}h-full object-cover{% endif %}"
loading="lazy"/>
Expand All @@ -53,7 +53,7 @@
sizes="{{sizes}}"
width="{{ optimizedImage.placeholderWidth }}"
height="{{ optimizedImage.placeholderHeight }}"
alt="{{ image.imageCaption }}"
alt="{{ image.alt }}"
class="w-full {% if block.showLargerVersionInPopup %}h-full object-cover{% endif %}"
loading="lazy"/>
{% endif %}
Expand Down
2 changes: 1 addition & 1 deletion templates/_site/_snippet/_content/_blocks/_slider.twig
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
srcset="{{ optimizedImage.srcset() }}"
sizes="(max-width: 819px) 100vw, (min-width: 820px) 780px"
width="{{optimizedImage.placeholderWidth}}" height="{{optimizedImage.placeholderHeight}}"
alt="{{ image.imageCaption }}"
alt="{{ image.alt }}"
loading="lazy"/>
</picture>
</a>
Expand Down
4 changes: 2 additions & 2 deletions templates/_site/_snippet/_content/_blocks/_textImage.twig
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
{% if image.extension == 'svg' or image.extension == 'gif' %}
<img src="{{ image.getUrl() }}"
width="{{image.width}}" height="{{image.height}}"
alt="{{ image.imageCaption }}"
alt="{{ image.alt }}"
class="w-full" loading="lazy"/>
{% else %}
<img src="{{ optimizedImage.placeholderBox() }}"
srcset="{{ optimizedImage.srcset() }}"
sizes="(max-width: 479px) 95vw, (min-width: 480px) and (max-width: 659px) 448px, (min-width: 660px) and (max-width: 819px) 628px, (min-width: 820px) and (max-width: 979px) 378px, (min-width: 980px) and (max-width: 1199px) 458px, (min-width: 1200px) 568px"
width="{{optimizedImage.placeholderWidth}}" height="{{optimizedImage.placeholderHeight}}"
alt="{{ image.imageCaption }}"
alt="{{ image.alt }}"
class="w-full" loading="lazy"/>
{% endif %}
</picture>
Expand Down

0 comments on commit 85f60a7

Please sign in to comment.