Skip to content

Instantly share code, notes, and snippets.

/gist:4320768
Created Dec 17, 2012

Embed
What would you like to do?
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
You can’t perform that action at this time.