Bug #102796
closedf:image would not add alt-text in alt-attribute of img-tag
0%
Description
The f:image Viewhelper disallow content in the alt-attribute.
Current Version TYPO3 11.5.33
See patch
Files
Updated by Oliver Bartsch 4 months ago
- Status changed from New to Needs Feedback
Hi,
actually I'm a bit confused. Did you experience this bug or is this report just on the VH's code? Because ImageViewHelper extends the AbstractTagBasedViewHelper
, which automatically adds all tag attributes, having a value set, see https://github.com/TYPO3/Fluid/blob/aa81073b0b5938916d8e0c83af7ca28600742053/src/Core/ViewHelper/AbstractTagBasedViewHelper.php#L123.
Additionally there were some adjustments done recently, which allow to also use empty alt attributes, see #102739.
Could you please check, whether this bug really exists in current main?
Best, Oli
Updated by Dieter Dr. Porth 4 months ago
sorry for my missleading headline.
The image-viewhelper add everytime an empty(!) alt-attribute to the img-tag.
The if-condition is wrong and make thing going south. (see patch)
// The alt-attribute is mandatory to have valid html-code, therefore add it even if it is empty if (empty($this->arguments['alt'])) { $this->tag->addAttribute('alt', $image->hasProperty('alternative') ? $image->getProperty('alternative') : ''); }
Updated by Stefan Bürk 4 months ago
The condition is correct. However, the code in the conditin block is wrong and may add a empty string if therr is also no alt description for the image.
Empty alt description attribute ahould be completly removed if empty.
Updated by Dieter Dr. Porth 4 months ago
Thanks for the feedback and sorry for the stolen time. You are right.
Please close this embarrassing ticket as quickly as possible. I had read something completely wrong.
Updated by Stefan Bürk 4 months ago
- Status changed from Needs Feedback to Closed
Please close this embarrassing ticket as quickly as possible. I had read something completely wrong.
Closing this issue than as requested. If needed, it can be reopened if additional information occures.