Index: branches/5.2.x/core/units/helpers/category_helper.php =================================================================== diff -u -N -r15782 -r16308 --- branches/5.2.x/core/units/helpers/category_helper.php (.../category_helper.php) (revision 15782) +++ branches/5.2.x/core/units/helpers/category_helper.php (.../category_helper.php) (revision 16308) @@ -1,6 +1,6 @@ Application->findModule('Name', $params['module']); - + return $this->Application->findModule('Name', $params['module']); } - elseif ( $category_ids ) { - // get module by category path - $module_root_categories = $this->getModuleRootCategories(); - $common_categories = array_intersect($category_ids, $module_root_categories); - $module_category_id = array_shift($common_categories); // get 1st common category - $module_info = $this->Application->findModule('RootCat', $module_category_id); - } - return $module_info; - } + // Get module by category path. + if ( $category_path ) { + foreach ( array_reverse($category_path) as $module_category_id ) { + $module_info = $this->Application->findModule('RootCat', $module_category_id); - /** - * Returns root categories from all modules - * - * @return Array - * @access protected - */ - protected function getModuleRootCategories() - { - static $root_categories = null; - - if ( !isset($root_categories) ) { - $root_categories = Array (); - foreach ($this->Application->ModuleInfo as $module_info) { - array_push($root_categories, $module_info['RootCat']); + if ( $module_info && $module_info['Var'] != 'adm' ) { + return $module_info; + } } - - $root_categories = array_unique($root_categories); } - return $root_categories; + return array(); } /** @@ -378,4 +358,4 @@ return $text; } - } \ No newline at end of file + }