? Success

User tests: Successful: Unsuccessful:

avatar bembelimen
bembelimen
9 Nov 2016

Summary of Changes

The JHtml class allows to override all calls which are made over the JHtml::_ method. That means, you can inject your own functions via plugin into this class to implement an alternative for the core implemention.

// onAfterInitialise trigger in your plugin
$framework = function($debug = null)
{
    // Do some fancy stuff here
};

JHtml::_('register', 'jhtml.bootstrap.framework', $framework);

So now everytime somewhere in Joomla! JHtml::('bootstrap.framework'); is called, this alternative function is used. So far so good.
But if you now use a default bootstrap method like `JHtml::
('bootstrap.tooltip');` the method "tooltip" does not use the ovewriten function from above but the default bootstrap.framework method.

This patch fixs this problem by calling always the correct function/method

Testing Instructions

Normaly the "clean" way is to create an plugin and implement the register stuff for JHtml there. For testing purpose a quick way would be to open components/com_content/content.php and add in line 11 the following code:

$framework = function($debug = null)
{
    exit('new function called');
};

JHtml::_('register', 'jhtml.bootstrap.framework', $framework);

JHtml::_('bootstrap.tooltip');

exit('new function skipped');

Now just open an article in the frontend.

Result

Before patch: default bootstrap stuff is loaded
After patch: site shows "new function called"

avatar bembelimen bembelimen - open - 9 Nov 2016
avatar bembelimen bembelimen - change - 9 Nov 2016
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 9 Nov 2016
Category Libraries
avatar dgt41
dgt41 - comment - 9 Nov 2016

I have tested this item successfully on d600636


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

avatar dgt41 dgt41 - test_item - 9 Nov 2016 - Tested successfully
avatar bembelimen bembelimen - change - 9 Nov 2016
The description was changed
avatar bembelimen bembelimen - edited - 9 Nov 2016
avatar mbabker
mbabker - comment - 9 Nov 2016

FWIW #12546 tries to do this globally but it'll honestly probably be quicker/easier to do this in smaller chunks.

avatar bembelimen
bembelimen - comment - 9 Nov 2016

@mbabker thanks for the link, yes I guess the smaller way is easier to handle

Edit: I looked into the patch from @okonomiyaki3000 and he only fixes the wrong JHtml::xxx calls, not internal static calls

avatar bembelimen bembelimen - change - 10 Nov 2016
The description was changed
avatar bembelimen bembelimen - edited - 10 Nov 2016
avatar matrikular
matrikular - comment - 11 Nov 2016

I have tested this item successfully on d600636

Tested with the provided instructions / code - workes as described.

avatar dgt41 dgt41 - change - 11 Nov 2016
Status Pending Ready to Commit
avatar zero-24
zero-24 - comment - 11 Nov 2016

RTC


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

avatar roland-d roland-d - alter_testresult - 13 Nov 2016 - matrikular: Tested successfully
avatar roland-d roland-d - change - 13 Nov 2016
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2016-11-13 05:08:13
Closed_By roland-d
avatar roland-d roland-d - close - 13 Nov 2016
avatar roland-d roland-d - merge - 13 Nov 2016
avatar roland-d roland-d - close - 13 Nov 2016
avatar roland-d roland-d - change - 13 Nov 2016
Labels Removed: ?

Add a Comment

Login with GitHub to post a comment