Changeset View
Changeset View
Standalone View
Standalone View
branches/5.2.x/core/units/helpers/category_helper.php
Show All 31 Lines | |||||
/** | /** | ||||
* Returns module information based on given module name or current category | * Returns module information based on given module name or current category | ||||
* (relative to module root categories). | * (relative to module root categories). | ||||
* | * | ||||
* @param array $params Tag params. | * @param array $params Tag params. | ||||
* @param array $category_path Category parent path. | * @param array $category_path Category parent path. | ||||
* | * | ||||
* @return array | * @return array|false | ||||
*/ | */ | ||||
public function getCategoryModule(array $params, array $category_path) | public function getCategoryModule(array $params, array $category_path) | ||||
{ | { | ||||
// Get module by name. | // Get module by name. | ||||
if ( isset($params['module']) ) { | if ( isset($params['module']) ) { | ||||
return $this->Application->findModule('Name', $params['module']); | return $this->Application->findModule('Name', $params['module']); | ||||
} | } | ||||
// Get module by category path. | // Get module by category path. | ||||
if ( $category_path ) { | if ( $category_path ) { | ||||
foreach ( array_reverse($category_path) as $module_category_id ) { | foreach ( array_reverse($category_path) as $module_category_id ) { | ||||
$module_info = $this->Application->findModule('RootCat', $module_category_id); | $module_info = $this->Application->findModule('RootCat', $module_category_id); | ||||
if ( $module_info && $module_info['Var'] != 'adm' ) { | if ( $module_info && $module_info['Var'] != 'adm' ) { | ||||
return $module_info; | return $module_info; | ||||
} | } | ||||
} | } | ||||
} | } | ||||
return array(); | return false; | ||||
} | } | ||||
/** | /** | ||||
* Converts multi-dimensional category structure in one-dimensional option array (category_id=>category_name) | * Converts multi-dimensional category structure in one-dimensional option array (category_id=>category_name) | ||||
* | * | ||||
* @param Array $data | * @param Array $data | ||||
* @param int $parent_category_id | * @param int $parent_category_id | ||||
* @param int $language_id | * @param int $language_id | ||||
▲ Show 20 Lines • Show All 293 Lines • Show Last 20 Lines |