getTemplateModuleStyles(); // Create one new option object for each available style, grouped by templates foreach ($templateStyles as $template => $styles) { $template = ucfirst($template); $groups[$template] = array(); foreach ($styles as $style) { $tmp = JHtml::_('select.option', $template . '-' . $style, $style); $groups[$template][] = $tmp; } } reset($groups); return $groups; } /** * Method to get the templates module styles. * * @return array The array of styles, grouped by templates. * * @since 3.0 */ protected function getTemplateModuleStyles() { $moduleStyles = array(); $templates = array($this->getSystemTemplate()); $templates = array_merge($templates, ModulesHelper::getTemplates('site')); foreach ($templates as $template) { $modulesFilePath = JPATH_SITE . '/templates/' . $template->element . '/html/modules.php'; // Is there modules.php for that template? if (file_exists($modulesFilePath)) { $modulesFileData = file_get_contents($modulesFilePath); preg_match_all('/function[\s\t]*modChrome\_([a-z0-9\-\_]*)[\s\t]*\(/i', $modulesFileData, $styles); if (!array_key_exists($template->element, $moduleStyles)) { $moduleStyles[$template->element] = array(); } $moduleStyles[$template->element] = $styles[1]; } } return $moduleStyles; } /** * Method to get the system template as an object. * * @return array The object of system template. * * @since 3.0 */ protected function getSystemTemplate() { $template = new stdClass; $template->element = 'system'; $template->name = 'system'; $template->enabled = 1; return $template; } }