Reputation: 998
I need to build an IMAGE TypoScript which will display the altText and titleText in the resulting <img>
HTML attributes.
This TypoScript does not work for some reason:
image = IMAGE
image {
file = fileadmin/user_upload/myimage.png
params = class="image-embed-item" loading="lazy"
titleText = TEXT
titleText.value = My Image Title
titleText.stdWrap.wrap = Bildtitel {|}
altText = TEXT
altText.value = My Image Alt Text
altText.stdWrap.wrap = Alt-Text {|}
imageLinkWrap >
}
The resulting image HTML is.
<img src="/example.com/fileadmin/_processed_/3/8/myimage_6a870622f1_c1450d54f1.png" width="134" height="198" class="image-embed-item" loading="lazy" alt="Alt-Text {TEXT}" title="Bildtitel {TEXT}"
TYPO3 processes it as {TEXT}
instead of using the value added to the TEXT
. "{My Image Title}" should have been in the .
I have already tried to use stdWrap
, wrap
, wrap2
, wrap3
, innerWrap
and outerWrap
without any success.
I am sure that there must be a solution for this.
Upvotes: 0
Views: 339
Reputation: 2557
You are mixing up different possibilities:
altText
is of type "string /stdWrap". So, in the simplest case, you can assign a string to the property and define a wrap:
image = IMAGE
image {
altText = My Image Alt Text
altText.wrap = Alt-Text |
}
If you have to do advanced stuff in your altText, you can use a cObject
:
image = IMAGE
image {
altText.cObject = TEXT
altText.cObject.value = My Image Alt Text
altText.cObject.stdWrap.wrap = Alt-Text |
}
Because of the order of rendering, it would also be possible to not wrap the string directly, but the whole cObject:
image = IMAGE
image {
altText.cObject = TEXT
altText.cObject.value = My Image Alt Text
altText.wrap = Alt-Text |
}
And last but not least, stdWrap
-function itself has a stdWrap
-property, so you could also do:
image {
altText.cObject = TEXT
altText.cObject.value = My Image Alt Text
altText.stdWrap.wrap = Alt-Text |
}
Upvotes: 1