2

I'm developing a custom Joomla template and have unset a lot of the core dependencies, such as jQuery and Bootstrap in the template's index.php.

The problem now is that the core extensions call some of Bootstrap's featuues, like so:

JHtml::_('tooltip', $tooltip, $options);

which in turn calls the Bootstrap library and the unset doesn't work as it tried to remove the file before it's called.

So I'd like to override some of the methods for the JHtmlBootstrap class, so that they return nothing, like so:

abstract class JHtmlBootstrap
{
    public static function tooltip() {
        return;
    }
}

I know I'm going to have to write a plugin, but not sure as to the best approach.

1 Answer 1

4

Create a system plugin and use JHtml::register() to register your custom methods.

defined('_JEXEC') or die;

use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Plugin\CMSPlugin;

class PlgSystemExample extends CMSPlugin
{
    public function onAfterInitialise()
    {
        HTMLHelper::register('bootstrap.tooltip', array(__CLASS__, 'noTooltips'));
    }

    public static function noTooltips()
    {
    }
}
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.