Skip to content

Instantly share code, notes, and snippets.

@AmyStephen
Created July 11, 2013 00:23
Show Gist options
  • Save AmyStephen/5971447 to your computer and use it in GitHub Desktop.
Save AmyStephen/5971447 to your computer and use it in GitHub Desktop.
System Plugin - onBeforeCompileHead - you can walk through any assets for the head. Where the head is rendered https://github.com/joomla/joomla-cms/blob/9c576378b4809a245f6fcf18bdbbd00baa4f7ac2/libraries/joomla/document/html/renderer/head.php
<?php
public function onBeforeCompileHead()
{
$head = JFactory::getDocument()->getHeadData();
$styleSheets = $head['styleSheets'];
$newStyleSheets = array();
foreach ($styleSheets as $key => $value)
{
if (/** test if you want it */)
{
$newStyleSheets[$key] = $value;
}
}
$head['styleSheets'] = $newStyleSheets;
JFactory::getDocument()->setHeadData($head);
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment