Back to ChromestyleField class

Method getTemplateModuleStyles

protected array
getTemplateModuleStyles
()
Method to get the templates module styles.
Returns
  • array The array of styles, grouped by templates.
Since
  • 3.0

Method getTemplateModuleStyles - Source code

/**
 * Method to get the templates module styles.
 *
 * @return  array  The array of styles, grouped by templates.
 *
 * @since   3.0
 */
protected function getTemplateModuleStyles()
{
    $moduleStyles = array();
    // Global Layouts
    $layouts = Folder::files(JPATH_SITE . '/layouts/chromes', '.*\\.php');
    foreach ($layouts as &$layout) {
        $layout = basename($layout, '.php');
    }
    $moduleStyles['system'] = $layouts;
    $templates = $this->getTemplates();
    $path = JPATH_ADMINISTRATOR;
    if ($this->clientId === 0) {
        $path = JPATH_SITE;
    }
    foreach ($templates as $template) {
        $chromeLayoutPath = $path . '/templates/' . $template->element . '/html/layouts/chromes';
        if (!Folder::exists($chromeLayoutPath)) {
            continue;
        }
        $layouts = Folder::files($chromeLayoutPath, '.*\\.php');
        if ($layouts) {
            foreach ($layouts as &$layout) {
                $layout = basename($layout, '.php');
            }
            $moduleStyles[$template->element] = $layouts;
        }
    }
    return $moduleStyles;
}