Image Slider Alt Tags

Permalink 2 users found helpful
I have searched and searched for an answer to what I feel is an easy question and cannot find a straightforward answer.

How are image alt tags added for images in the Image Slider block?

I have gone through File Manager for each of the images used and updated the Title and the Description, neither of which reflect through the source code. I have tried replacing the original images with the updated ones; I have cleared the cache in case changes were hanging; I even waited overnight to see if the changes just weren't being reflected immediately.

I feel like these Title and Description fields are misleading also. From what I understand, Title should be the Alt, Description is not used for anything outside of File Manager, and there is no field for Title which would be for mouseover etc.

Thank you for your input!

bmswebsi
 
MrKDilkington replied on at Permalink Best Answer Reply
MrKDilkington
Hi bmswebsi,

The alt attribute for slide images is added here:
https://github.com/concrete5/concrete5/blob/develop/concrete/blocks/...

The alt attribute value comes from the Title input field in the Image Slider block form, not the image's title file attribute.

You can change this behavior by creating a custom template:
- this will use the block form Title input, fallback to the image title file attribute, and fallback again to the default image filename
if ($row['title']) {
    $tag->alt($row['title']);
} elseif ($f->getTitle()) {
    $tag->alt($f->getTitle());
}

- this will use the image title file attribute, fallback to the block form Title input, and fallback again to the default image filename
if ($f->getTitle()) {
    $tag->alt($f->getTitle());
} elseif ($row['title']) {
    $tag->alt($row['title']);
}
bmswebsi replied on at Permalink Reply
bmswebsi
I want to firstly thank you for your insightful reply and furthermore for everything that you do on Concrete5; you are a real benefit to the community!

After creating and going into application/blocks/image_slider/templates/Title_Alt_Tags, I copied from the core block the view.css, the view.js, and the view.php files. I then parsed out the section of code which was highlighted in GitHub and placed in the second set of code from your reply in the view.php file.

I had to make sure there were not two } at the end of the snippet which initially broke the code, but other than that it went in perfectly.

Thanks again!