本文整理汇总了PHP中Navigation::get_section方法的典型用法代码示例。如果您正苦于以下问题:PHP Navigation::get_section方法的具体用法?PHP Navigation::get_section怎么用?PHP Navigation::get_section使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Navigation
的用法示例。
在下文中一共展示了Navigation::get_section方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
/**
* Initialize navigation system
*
* @param array $sitemap
*/
public static function init(array $sitemap)
{
foreach ($sitemap as $section) {
// Invalid
if (!isset($section['name'])) {
continue;
}
// Add page
if (isset($section['url']) && !isset($section['top'])) {
//var_dump($section);
$page = Navigation_Page::factory($section);
$section_object = Navigation::get_root_section();
$section_object->add_page($page);
} else {
$section_object = Navigation::get_section($section['name'], null, isset($section['priority']) ? $section['priority'] : 1);
// URL
if (isset($section['url'])) {
$section_object->url = $section['url'];
}
// Icon
if (isset($section['icon'])) {
$section_object->icon = $section['icon'];
}
// Buttons
if (isset($section['buttons'])) {
$section_object->add_buttons($section['buttons']);
}
// Priority
if (isset($section['priority'])) {
$section_object->priority = (int) $section['priority'];
}
if (!empty($section['children'])) {
$section_object->add_pages($section['children']);
}
}
}
}
示例2: add_pages
/**
* Add multiple pages to section
*
* @param array $pages
*/
public function add_pages(array $pages)
{
foreach ($pages as $page) {
if (isset($page['children'])) {
$section = Navigation::get_section($page['name'], $this);
if (isset($page['icon'])) {
$section->icon = $page['icon'];
}
// Buttons
if (isset($section['buttons'])) {
$section->add_buttons($section['buttons']);
}
// Hijos
if (count($page['children']) > 0) {
$section->add_pages($page['children']);
}
} else {
$page = Navigation_Page::factory($page);
$this->add_page($page);
}
}
}