items() публичный статический Метод

Sets or returns menu data in array
public static items ( $menu = 'sidebar', $items = null ) : array
$items array if empty, the current menu is returned.
Результат array
Пример #1
0
 /**
  * testAdminMenus
  */
 public function testAdminMenus()
 {
     CakeSession::write('Auth.User', array('id' => 1, 'role_id' => 1));
     CroogoNav::add('contents', array('title' => 'Contents', 'url' => '#'));
     $items = CroogoNav::items();
     $expected = '<ul class="nav nav-stacked"><li><a href="#" class="menu-contents sidebar-item"><i class="icon-white icon-large"></i> <span>Contents</span></a></li></ul>';
     $result = $this->Croogo->adminMenus(CroogoNav::items());
     $this->assertEquals($expected, $result);
 }
Пример #2
0
 public function testNavOverwrite()
 {
     $defaults = CroogoNav::getDefaults();
     $items = CroogoNav::items();
     $expected = Hash::merge($defaults, array('title' => 'Permissions', 'url' => array('admin' => true, 'plugin' => 'acl', 'controller' => 'acl_permissions', 'action' => 'index'), 'weight' => 30));
     $this->assertEquals($expected, $items['users']['children']['permissions']);
     $item = array('title' => 'Permissions', 'url' => array('admin' => true, 'plugin' => 'acl_extras', 'controller' => 'acl_extras_permissions', 'action' => 'index'), 'weight' => 30);
     CroogoNav::add('users.children.permissions', $item);
     $items = CroogoNav::items();
     $expected = Hash::merge($defaults, array('title' => 'Permissions', 'url' => array('admin' => true, 'plugin' => 'acl_extras', 'controller' => 'acl_extras_permissions', 'action' => 'index'), 'weight' => 30));
     $this->assertEquals($expected, $items['users']['children']['permissions']);
 }