? ? Pending

User tests: Successful: Unsuccessful:

avatar zero-24
zero-24
27 Sep 2020

Pull Request for Issue #30615

Summary of Changes

Make sure we support both strings and arrays passed as attributes. cc @SharkyKZ

Testing Instructions

  • install 4.0-dev
  • setup an contact with an contact image
  • add it to a menu
  • open it on the frontend
  • check that the loading=lazy attribute is there.
  • Add <?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#L106
  • Notice the german flag when checking the frontend.
  • notice it does not has the loading attribute set.
  • apply the patch
  • notice that loading=lazy is gone for the contact menu image too.
  • notice there is no waring when using the code mention above anymore.

Actual result BEFORE applying this Pull Request

warning when using NULL or an string as attributes

Expected result AFTER applying this Pull Request

no warning anymore and no default to loading=lazy

Documentation Changes Required

None

avatar zero-24 zero-24 - open - 27 Sep 2020
avatar zero-24 zero-24 - change - 27 Sep 2020
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 27 Sep 2020
Category Libraries
avatar zero-24 zero-24 - change - 27 Sep 2020
Labels Added: ?
avatar ceford
ceford - comment - 28 Sep 2020

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.
avatar zero-24
zero-24 - comment - 28 Sep 2020

Yes sorry that use was missing from my test instructions.

avatar SharkyKZ
SharkyKZ - comment - 28 Sep 2020

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.

avatar adj9 adj9 - test_item - 28 Sep 2020 - Not tested
avatar adj9
adj9 - comment - 28 Sep 2020

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.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/30790.

avatar adj9 adj9 - test_item - 28 Sep 2020 - Not tested
avatar adj9 adj9 - test_item - 28 Sep 2020 - Not tested
avatar adj9
adj9 - comment - 28 Sep 2020

I have not tested this item.

with use Joomla\CMS\HTML\HTMLHelper; done PR
Schermata 2020-09-28 alle 13 13 29


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/30790.
avatar adj9
adj9 - comment - 28 Sep 2020

I have not tested this item.

with use Joomla\CMS\HTML\HTMLHelper; done PR


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/30790.

avatar adj9 adj9 - test_item - 28 Sep 2020 - Tested successfully
avatar adj9
adj9 - comment - 28 Sep 2020

I have tested this item successfully on 9b19e3f

with use Joomla\CMS\HTML\HTMLHelper; done PR


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/30790.

avatar zero-24 zero-24 - change - 28 Sep 2020
The description was changed
avatar zero-24 zero-24 - edited - 28 Sep 2020
avatar zero-24
zero-24 - comment - 28 Sep 2020

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 :)

avatar SharkyKZ
SharkyKZ - comment - 28 Sep 2020

The check for existing attribute is still wrong.

avatar zero-24
zero-24 - comment - 28 Sep 2020

The check for existing attribute is still wrong.

What is wrong do you have a bit more detail? How can we do it better?

avatar dgrammatiko
dgrammatiko - comment - 28 Sep 2020

@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

avatar zero-24
zero-24 - comment - 29 Sep 2020

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.

avatar dgrammatiko
dgrammatiko - comment - 29 Sep 2020

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...

avatar SharkyKZ
SharkyKZ - comment - 29 Sep 2020

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.

avatar dgrammatiko
dgrammatiko - comment - 29 Sep 2020

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

avatar zero-24
zero-24 - comment - 29 Sep 2020

Done

avatar zero-24
zero-24 - comment - 29 Sep 2020

(i dont see any extension dev taking up on that but lets see how it evolves)

avatar zero-24 zero-24 - change - 4 Oct 2020
The description was changed
avatar zero-24 zero-24 - edited - 4 Oct 2020
avatar zero-24
zero-24 - comment - 4 Oct 2020

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.

avatar zero-24 zero-24 - change - 4 Oct 2020
The description was changed
avatar zero-24 zero-24 - edited - 4 Oct 2020
avatar tushar33 tushar33 - test_item - 17 Oct 2020 - Tested unsuccessfully
avatar tushar33
tushar33 - comment - 17 Oct 2020

I have tested this item ? unsuccessfully on a642024

1. Image is broken without applying patch and after
2. no warning when using NULL or an string as attributes


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/30790.
avatar zero-24
zero-24 - comment - 17 Oct 2020

@tushar33

  1. Image is broken without applying patch and after

Than this is not an issue with this specific PR and should get its own issue. Can you please post the steps you took and make a new Issue so we keep track of that?

avatar PhocaCz PhocaCz - test_item - 17 Oct 2020 - Tested unsuccessfully
avatar PhocaCz
PhocaCz - comment - 17 Oct 2020

I have tested this item ? unsuccessfully on a642024

Hi, I get no warning when using NULL or an string as attribute (tested J! 4 Beta 5, tested prebuilt package)


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/30790.

avatar dgrammatiko dgrammatiko - test_item - 17 Oct 2020 - Tested successfully
avatar dgrammatiko
dgrammatiko - comment - 17 Oct 2020

I have tested this item successfully on a642024


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/30790.

avatar dgrammatiko
dgrammatiko - comment - 17 Oct 2020

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...

avatar richard67
richard67 - comment - 17 Oct 2020

@tushar33 @PhocaCz Please reset your test result to "I have not tested this item" (or so) in the issue tracker if your issue is not related to this PR (what I assume now after reading). If necessary open a new issue. Tanks in advance.

avatar PhocaCz PhocaCz - test_item - 17 Oct 2020 - Not tested
avatar PhocaCz
PhocaCz - comment - 17 Oct 2020

I have not tested this item.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/30790.

avatar Quy Quy - test_item - 19 Oct 2020 - Tested successfully
avatar Quy
Quy - comment - 19 Oct 2020

I have tested this item successfully on a642024


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/30790.

avatar Quy Quy - change - 19 Oct 2020
Status Pending Ready to Commit
avatar Quy
Quy - comment - 19 Oct 2020

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/30790.

avatar rdeutz rdeutz - close - 27 Oct 2020
avatar rdeutz rdeutz - merge - 27 Oct 2020
avatar rdeutz rdeutz - change - 27 Oct 2020
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

Add a Comment

Login with GitHub to post a comment