Skip to content

Instantly share code, notes, and snippets.

Created December 17, 2012 18:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/4320768 to your computer and use it in GitHub Desktop.
Save anonymous/4320768 to your computer and use it in GitHub Desktop.
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