public function testNestedArray() { $p = new pui(); $submenu = array('a', 'b'); $menu = array($p->link('1.html', 'one'), $p->ulist()->addArray($submenu)); $this->assertEquals($p->ulist()->addArray($menu)->asHtml(), ' <ul> <li><a href="1.html">one</a></li> <li> <ul> <li>a</li> <li>b</li> </ul> </li> </ul>'); }
public function __construct() { parent::__construct('div', array('class' => 'navbar navbar-default', 'role' => 'navigation')); $nav_list = pui::ulist('nav navbar-nav'); $nav_menu = pui::element('div', array('class' => 'collapse navbar-collapse'))->add($nav_list); $this->add(pui::element('div', array('class' => 'container-fluid'))->add(pui::element('div', array('class' => 'navbar-header'))->add(pui::element('button', array('type' => 'button', 'class' => 'navbar-toggle collapsed', 'data-toggle' => 'collapse', 'data-target' => '#' . $nav_menu->get_id(), 'aria-expanded' => 'false'))->add(pui::element('span', array('class' => 'sr-only', 'text' => 'Toggle navigation')), pui::element('span', array('class' => 'icon-bar')), pui::element('span', array('class' => 'icon-bar')), pui::element('span', array('class' => 'icon-bar'))), pui::element()->addContent(func_get_args())), $nav_menu)); $this->inner = $nav_list; }