User tests: Successful: Unsuccessful:
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
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.
Before patch: default bootstrap stuff is loaded
After patch: site shows "new function called"
Status | New | ⇒ | Pending |
Category | ⇒ | Libraries |
@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
Status | Pending | ⇒ | Ready to Commit |
RTC
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 |
Labels |
Removed:
?
|
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.