protected function getFormattedMenu($menu, &$params) { $app = JFactory::getApplication(); // get the base menu data structure // Run the basic formatter $this->formatMenu($menu); $default_module_theme_dir = JPath::clean('/modules/mod_roknavmenu/themes'); $theme = $this->getThemePath($params); $theme_name = basename($params->get('theme', $theme)); $formatter_path = $this->getFormatterPath($params); //load the formatter require_once $formatter_path; $theme_type = 'Template'; // Find if this is a Default or Template theme if (dirname(JPath::clean($params->get('theme'))) == $default_module_theme_dir) { $theme_type = 'Default'; } // run the formatter class $theme_formatter_class = 'RokNavMenuFormatter' . str_replace('-', '', $theme_type . $theme_name); if (class_exists($theme_formatter_class)) { $formatter = new $theme_formatter_class(); $formatter->format_tree($menu); } else { if (class_exists('RokNavMenuFormatter')) { $formatter = new RokNavMenuFormatter(); $formatter->format_tree($menu); } } return $menu; }
function getFormattedMenu($menu, &$params) { global $mainframe; // get the base menu data structure // Run the basic formatter modRokNavMenuHelper::formatMenu($menu); //see if the custom_formatter is set. $template_formatter = $params->get('custom_formatter', "default"); $default_formatter = $params->get('default_formatter', "default"); $template_named_formatter_path = JPATH_ROOT . DS . 'templates' . DS . $mainframe->getTemplate() . DS . 'html' . DS . 'mod_roknavmenu' . DS . 'formatters' . DS . $template_formatter . '.php'; $template_default_formatter_path = JPATH_ROOT . DS . 'templates' . DS . $mainframe->getTemplate() . DS . 'html' . DS . 'mod_roknavmenu' . DS . 'formatter.php'; $default_named_formatter_path = JPATH_ROOT . DS . 'modules' . DS . 'mod_roknavmenu' . DS . 'formatters' . DS . $default_formatter . '.php'; if (JFile::exists($template_named_formatter_path)) { //there is a custom_formatter defined //Run the template formatter if its there if not run the default formatter //see if there is a custom formatter defined require_once $template_named_formatter_path; } else { if (JFile::exists($template_default_formatter_path)) { require_once $template_default_formatter_path; } else { if (JFile::exists($default_named_formatter_path)) { require_once $default_named_formatter_path; } } } $formatter = new RokNavMenuFormatter(); $formatter->format_tree($menu); return $menu; }