override for /layouts/joomla/content/full_image.php // alt attributes for images

22 views
Skip to first unread message

Mike

unread,
Jul 16, 2022, 5:26:32 PM7/16/22
to Joomla! General Development
I need to make some adjustments to

/layouts/joomla/content/full_image.php

in Joomla 4.1.5.

For all (full) article images without an alt attribute the alt attribute should be the title of the article.

That works fine with adding the line

$item       = $displayData;

and replacing  

'alt'      => empty($images->image_fulltext_alt) && empty($images->image_fulltext_alt_empty) ? false : $images->image_fulltext_alt,

with

'alt'      => $item->title,

Anyway, my challenge now is to only set the article title as an alt attribute in case I did not define an alt attribute in the article settings. I tried but I failed so far. But this should be an easy one, right?
Reply all
Reply to author
Forward
0 new messages