Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't skip JHtml's bootstrap call for ovewrite check #12854

Merged
merged 1 commit into from Nov 13, 2016

Conversation

bembelimen
Copy link
Contributor

@bembelimen bembelimen commented Nov 9, 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"

@dgrammatiko
Copy link
Contributor

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.

@mbabker
Copy link
Contributor

mbabker commented Nov 9, 2016

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

@bembelimen
Copy link
Contributor Author

bembelimen commented Nov 9, 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

@matrikular
Copy link
Contributor

I have tested this item ✅ successfully on d600636

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

@zero-24
Copy link
Contributor

zero-24 commented Nov 11, 2016

RTC


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

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Nov 11, 2016
@roland-d roland-d merged commit af98a75 into joomla:staging Nov 13, 2016
@roland-d roland-d added this to the Joomla 3.7.0 milestone Nov 13, 2016
@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Nov 13, 2016
@bembelimen bembelimen deleted the patch-13 branch May 15, 2018 09:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants