예제 #1
0
 /**
  * Add children to menu under the give name
  *
  * @param string $name
  * @param object $children
  * @param Builder|MenuItem $menu
  */
 private function addChildrenToMenu($name, $children, $menu)
 {
     $menu->dropdown($name, function (MenuItem $subMenu) use($children) {
         foreach ($children as $child) {
             $this->addSubItemToMenu($child, $subMenu);
         }
     });
 }
예제 #2
0
파일: MenuTest.php 프로젝트: imihael/menus
 public function testCreateMenuFromBuilder()
 {
     $builder = new Builder('top', $this->config);
     $home = $builder->add(['title' => 'Home', 'url' => '/', 'icon' => 'fa fa-dashboard']);
     $settings = $builder->add(['title' => 'Settings', 'url' => '/settings', 'icon' => 'fa fa-tools']);
     $this->assertInstanceOf('Pingpong\\Menus\\MenuItem', $home);
     $this->assertEquals($builder->count(), 2);
 }