Joomla 3 Plugin to disable Bootstrap
<?php | |
defined('_JEXEC') or die; | |
class plgSystemDisable_bootstrap extends JPlugin { | |
function onBeforeCompileHead() { | |
$app = JFactory::getApplication(); | |
if (!$app->isAdmin()) { | |
$on = $this->params->get('disabled', 0); | |
if ($on) { | |
$doc = JFactory::getDocument(); | |
if(!method_exists($doc,'getHeadData')) | |
{ | |
return; | |
} | |
$headers = $doc->getHeadData(); | |
$scripts = isset($headers['scripts']) ? $headers['scripts'] : array(); | |
$headers['scripts'] = array(); | |
foreach($scripts as $url=>$type) | |
{ | |
if (strpos($url, 'bootstrap') === false) | |
{ | |
$headers['scripts'][$url] = $type; | |
} | |
} | |
$doc->setHeadData($headers); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment