Skip to content

Instantly share code, notes, and snippets.

@betweenbrain
Last active December 17, 2015 05:58
Show Gist options
  • Save betweenbrain/5561375 to your computer and use it in GitHub Desktop.
Save betweenbrain/5561375 to your computer and use it in GitHub Desktop.
Proposed change to allow `JHtml::_('bootstrap.loadCss')` usage auto detect language direction
/**
* Loads CSS files needed by Bootstrap
*
* @param boolean $includeMainCss If true, main bootstrap.css files are loaded
* @param string $direction rtl or ltr direction. If empty, ltr is assumed
* @param array $attribs Optional array of attributes to be passed to JHtml::_('stylesheet')
*
* @return void
*
* @since 3.0
*/
public static function loadCss($includeMainCss = true, $direction = NULL, $attribs = array())
{
// Load Bootstrap main CSS
if ($includeMainCss)
{
JHtml::_('stylesheet', 'jui/bootstrap.min.css', $attribs, true);
JHtml::_('stylesheet', 'jui/bootstrap-responsive.min.css', $attribs, true);
JHtml::_('stylesheet', 'jui/bootstrap-extended.css', $attribs, true);
}
// Load Bootstrap RTL CSS
if ($direction == 'rtl' || ($direction = NULL && JFactory::getDocument()->direction == 'rtl'))
{
JHtml::_('stylesheet', 'jui/bootstrap-rtl.css', $attribs, true);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment