User tests: Successful: Unsuccessful:
Pull Request for Issue #30615
Make sure we support both strings and arrays passed as attributes. cc @SharkyKZ
<?php echo Joomla\CMS\HTML\HTMLHelper::_('image', 'mod_languages/de.gif', '', null, true); ?>
to this line https://github.com/joomla/joomla-cms/blob/4.0-dev/templates/cassiopeia/index.php#L106warning when using NULL or an string as attributes
no warning anymore and no default to loading=lazy
None
Status | New | ⇒ | Pending |
Category | ⇒ | Libraries |
Labels |
Added:
?
|
Yes sorry that use was missing from my test instructions.
Running unnecessary type checks. Running strpos()
against null
. Attribute is added when already exists. Attribute not added when another attribute containing loading
in its name exists. Does not account for whitespaces.
I have not tested this item.
With step 6 I logged into the frontend and on each page I have the message:
The requested page can't be found.
With and without PR.
If you restore the index.php file, I don't have the message.
I have not tested this item.
with use Joomla\CMS\HTML\HTMLHelper; done PR
I have not tested this item.
with use Joomla\CMS\HTML\HTMLHelper; done PR
I have tested this item
with use Joomla\CMS\HTML\HTMLHelper; done PR
Running unnecessary type checks. Running strpos() against null. Attribute is added when already exists. Attribute not added when another attribute containing loading in its name exists. Does not account for whitespaces.
Thanks should be fixed now.
with use Joomla\CMS\HTML\HTMLHelper; done PR
Yes sorry updated the description too :)
The check for existing attribute is still wrong.
The check for existing attribute is still wrong.
What is wrong do you have a bit more detail? How can we do it better?
@zero-24 since my other PR #30784 is defaulting but not forcing only lazyloaded images I think these changes need some rethinking. I mean the helper already has everything it needs, therefore there is no need for special treatment for lazyloading, eg: https://repl.it/@dgrammatiko/HTMLHelperImage#main.php
I guess we overdid it when we introduced lazyloading...
My 2c anyways
since my other PR #30784 is defaulting but not forcing only lazyloaded images I think these changes need some rethinking.
hmm it is the same here. It is just defaulting but not forcing only. As you can pass loading=eager and than we dont add loading=lazy. The reason is that when you use the html helper the developer knows whether that can / should be lazyloaded or not so they can configure the html helper.
hmm it is the same here. It is just defaulting but not forcing only.
I guess then the code part that checks for the string attributes should be changed to reflect that, eg if there is no loading=eager or loading = auto then add lading = lazy, so it needs a bit of regex...
It is just defaulting but not forcing only.
But it shouldn't. Developers should really pass this on their own, preferably with image dimensions. Such a generic method just shouldn't be stuffing random attributes nobody asks for.
Developers should really pass this on their own,
@SharkyKZ I will agree, maybe expand the docs block with an example is all we need here, eg: https://repl.it/@dgrammatiko/HTMLHelperImage#main.php
Done
(i dont see any extension dev taking up on that but lets see how it evolves)
Test instructions has been updated as requested right now the default has been fully removed with the developer to choose and use the attribute that is already there.
I have tested this item
1. Image is broken without applying patch and after
2. no warning when using NULL or an string as attributes
I have tested this item
Hi, I get no warning when using NULL or an string as attribute (tested J! 4 Beta 5, tested prebuilt package)
I have tested this item
Hi, I get no warning when using NULL or an string as attribute (tested J! 4 Beta 5, tested prebuilt package)
What kind of warning do you expect?
This exact code exists in Joomla for many years, all this PR is doing is reverting the enforced addition of one single attribute...
I have not tested this item.
I have tested this item
Status | Pending | ⇒ | Ready to Commit |
RTC
Status | Ready to Commit | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2020-10-27 12:46:38 |
Closed_By | ⇒ | rdeutz |
I found that I needed to add use Joomla\CMS\HTML\HTMLHelper; to index.php and the German flag has loading="lazy" whether or not the patch is applied. Does this mean the patch can only be tested with a new install?
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/30790.