Helix Ultimate 2.2.1 - Bug In The Layout Intro_image.php - Question | JoomShaper
Black Friday sale is live with flat 50% OFF. Sale ends soon! Grab your deal now!

Helix Ultimate 2.2.1 - Bug In The Layout Intro_image.php

A

Alvaro

Helix Framework 1 week ago

Currently, the image's alt attribute displays the article title, even though the image has its own alt attribute.

The problem is a redeclaration of $layoutAttr. From lines 74 to 84, the attributes are constructed correctly, but on line 95, a simple redeclaration is made without considering that it already exists.

The $layoutAttr on line 95 would make sense if if($introImge) only checked for the intro image from Helix, but $introImage retrieves the image from Helix or the Joomla core lines earlier. Furthermore, on line 60, execution stops if the intro image doesn't exist in Helix or the Joomla core. Therefore, if($introImge) is unnecessary, and all the code from line 106 onward is also unnecessary because the ELSE condition won't be met.

I've included my temporary solution at the end. Because if $introImge can get the value of the intro from Helix or the Joomla core, the output needs improvement, such as removing the div from the <a> tag, among other things. Or, if $introImage is only going to check the Helix image as in the past, then all the code also needs to be cleaned up.

Regards

Replace lines from 95 to 99 with: echo LayoutHelper::render('joomla.html.image', $layoutAttr);

0
6 Answers
Paul Frankowski
Paul Frankowski
Accepted Answer
Senior Staff 1 week ago #210109

Hi Alvaro,

Thanks for the explanation and details. I shared info with our Helix developer team they will check code after the weekend. Can you also share full path to file and fixed file itself, just as example.

And yes, I can confirm issue.

0
A
Alvaro
Accepted Answer
1 week ago #210114

The full path to the file is: plugins/system/helixultimate/overrides/layouts/joomla/content/intro_imape.php

I'm not allowed to attach files here, so I'll share it via a URL valid for 7 days.

As I mentioned, the file only solves the problem of displaying the correct text in the alt attribute. However, the file needs improvement depending on whether you want a single response for the intro image from both Helix and Joomla Core. In that case, the lines starting at 106 should be removed, and the output in if($introImage) should be improved. But if you want separate outputs, $introImage should only receive values from the Helix intro image. This is my humble opinion.

Regards.

0
Paul Frankowski
Paul Frankowski
Accepted Answer
Senior Staff 5 days ago #210315

Ok, I have confirmation it was already fixed, and will be included in next update, you can test even now >> https://limewire.com/d/k7uOl#6VaOm234GL

0
A
Alvaro
Accepted Answer
5 days ago #210375

Hi Paul. I read the code in intro_image.php and saw that it wouldn't pass the tests. I tested it, and it failed. As I said from the beginning, the problem wasn't just that it wasn't displaying the alt attribute correctly (fixed in your improved file). The problem was also that the block from lines 92 to 105 (of your improved file) was handling both the Helix and Joomla Core images, which meant that the Core images were displayed without captions, making all the code from line 105 onward unnecessary. All of this is because $introImage gets the value from both Helix and Joomla Core.

That's why I decided to modify the file and test it simultaneously with a Helix image and a Joomla Core image. The file we modified correctly handles Helix images and their alt attribute; if there's no alt attribute, the title is loaded. It works the same way with Joomla Core images, which also display the caption if one is assigned. The file can be used as is, or for more demanding users, unnecessary code can be removed or duplicate code simplified. Let me know your thoughts.

Modified file https://limewire.com/d/LBA9w#JtBQXkex0p

Regards

0
A
Alvaro
Accepted Answer
2 days ago #210687

Hello, I need to know if you've identified the full problem and if there's a solution yet, or if you've reviewed my proposed solution. I'm not trying to bother you, but I have over 70 sites that have been updated to Helix Ultimate 2.2.1, and almost all of them use the Joomla core image. Currently, they're missing captions and correct alt attributes, and this hasn't only affected the sites I manage but everything powered by Helix. We can't simply create overrides. Thank you.

0
A
Alvaro
Accepted Answer
2 days ago #210691

Fixed Deprecated: htmlspecialchars(): Passing null to parameter If $imgfloat return null https://limewire.com/d/2ORQW#HKn1fDvK8P

0