Exemple #1
0
 /**
  * Get menu items from the platform.
  *
  * @param int $levels
  * @return array    List of routes to the pages.
  */
 protected function getItemsFromPlatform($params)
 {
     $menu = new \TimberMenu($params['menu']);
     if ($menu) {
         return $menu->get_items();
     }
     return null;
 }
Exemple #2
0
 function testMenuHome()
 {
     $this->_createTestMenu();
     $menu = new TimberMenu();
     $items = $menu->get_items();
     $item = $items[2];
     $this->assertEquals('/', $item->link());
     $this->assertEquals('/', $item->path());
     $item = $items[5];
     $this->assertEquals('http://example.org', $item->link());
     //I'm unsure what the expected behavior should be here, so commenting-out for now.
     //$this->assertEquals('/', $item->path() );
 }
 function testConstructMenuBySlug()
 {
     $items = array();
     $items[] = (object) array('type' => 'link', 'link' => '/');
     $items[] = (object) array('type' => 'link', 'link' => '/foo');
     $items[] = (object) array('type' => 'link', 'link' => '/bar/');
     $this->buildMenu('Jolly Jeepers', $items);
     $menu = new TimberMenu('jolly-jeepers');
     $this->assertEquals(3, count($menu->get_items()));
 }