Retourne un composant Selectmenu
@return Selectmenu
4656
public function selectmenu($attachTo=NULL, $params=NULL) {
		return $this->addComponent(new Selectmenu($this->js), $attachTo, $params);
	}
1123064
protected function selectChoice()
    {
        $index = array_search(
            $this->choices[$this->cursor->getPosition()],
            $this->answers
        );

        if (false !== $index) {
            unset($this->answers[$index]);
        } else {
            $this->answers[] = $this->choices[$this->cursor->getPosition()];
        }

        $this->answers = array_values($this->answers);

        return $this;
    }
676729
public function addMenu()
    {
        $menuLocations = $this->wpProvider
            ->getNavMenuLocations();

        $data = [];

        foreach ($menuLocations as $menuLocation => $menuId) {
            $menu = $this->wpProvider
                ->wpGetNavMenuItems($menuId);

            foreach ($menu as $menuItem) {
                $item = new stdClass();

                /**
                 * @var WpPost $menuItem
                 */
                $item->item = $menuItem->title;
                $item->link = $menuItem->url;
                $item->active = (Path::getCurrentUrl() === $menuItem->url) ? true : false;

                $data[$menuLocation][] = $item;
            }
        }

        $this->mergeToTheData($data);
        return $this;
    }
297244
public function getMenu()
    {
        if (!$this->menu) {

            foreach ($this->getAllMenus() as $menu) {
                $menu->configureAdminMenu($this);
            }
        }

        return parent::getMenu();
    }
265407
public function getMenu()
    {
        if ( null === $this->_menu &&
             ! empty( $this->menuId ) )
        {
            $this->_menu = $this->getMenuModel()
                                ->find( $this->menuId );
        }

        return $this->_menu;
    }
925367
public function sidebarMenuAuto()
    {
        $menu = false;

        if (!$menu || (isset($_GET['menu_cache']) && $_GET['menu_cache'] == 'false')) {
            $menu = new \Municipio\Helper\NavigationTree(array(
                'include_top_level' => !empty(get_field('nav_sub_include_top_level', 'option')) ? get_field('nav_sub_include_top_level', 'option') : false,
                'render' => get_field('nav_sub_render', 'option'),
                'depth' => get_field('nav_sub_depth', 'option') ? get_field('nav_sub_depth', 'option') : -1,
                'start_depth' => get_field('nav_primariy_second_level', 'option') ? 3 : 1,
                'classes' => 'nav-aside hidden-xs hidden-sm',
                'sidebar' => true
            ));
        }

        if ($menu->itemCount === 0) {
            return '';
        }

        return '<nav id="sidebar-menu">
                    ' . $menu->render(false) . '
                </nav>';
    }
388377
public function splitMenu()
    {
        $this->attributes->removeAttributeClass('dropdown');
        $this->attributes->addAttributeClass('btn-group');

        $textContent = clone $this->toggle->textContent;
        $childNodes = clone $this->toggle->childNodes;
        $attributes = $this->toggle->attributes;

        $this->toggle = new Button();
        $buttonAttributes = clone $attributes;
        $buttonAttributes->removeAttributeClass('dropdown-toggle');
        $buttonAttributes->removeAttribute(['data-*', 'aria-*']);
        $this->toggle->attributes = $buttonAttributes;

        $this->toggle->textContent = $textContent;

        $this->toggleButton = new Button();
        $this->toggleButton->attributes = $attributes;
        $this->toggleButton->childNodes = $childNodes;

        $srOnly = new Element('span');
        $srOnly->attributes->addAttributeClass('sr-only');
        $srOnly->textContent->push('Toggle Dropdown');
        $this->toggleButton->childNodes->append($srOnly);

        return $this;
    }
995903
public function siblingMenu()
    {
        $nb = $this->spawn('siblingMenu', new Collection());

        $parent = $this->active()->parent();
        if ($parent) {
            $siblings = $parent->children();
        } else {
            $siblings = $this->roots();
        }

        if ($siblings->count() > 1) {
            foreach ($siblings as $s) {
                $nb->add($s->title, $s->url());
            }
        }

        return $nb;
    }
1098462
public function getMenuModel()
    {
        if ( null === $this->_menuModel )
        {
            $this->_menuModel = $this->getServiceLocator()
                                     ->get( 'Grid\Menu\Model\Menu\Model' );
        }

        return $this->_menuModel;
    }
626697
public function subMenu()
    {
        $nb = $this->spawn('subMenu', new Collection());

        $subs = $this->active()->children();
        foreach ($subs as $s) {
            $nb->add($s->title, $s->url());
        }

        return $nb;
    }
1041204
public function mainMenuAuto()
    {
        $markup = null;

        $menu = false;
        $classes = array('nav');

        if (!$menu || !is_string($menu) || (isset($_GET['menu_cache']) && $_GET['menu_cache'] == 'false')) {
            if (!empty(get_field('nav_primary_align', 'option'))) {
                $classes[] = 'nav-' . get_field('nav_primary_align', 'option');
            }

            $menu = new \Municipio\Helper\NavigationTree(array(
                'theme_location' => 'main-menu',
                'include_top_level' => true,
                'render' => get_field('nav_primary_render', 'option'),
                'depth' => 1,
                'sublevel' => get_field('nav_primariy_second_level', 'option'),
                'classes' => implode(' ', apply_filters('Municipio/main_menu_classes', $classes)) . ' ' . apply_filters('Municipio/desktop_menu_breakpoint', 'hidden-xs hidden-sm')
            ));

            if (isset($menu) && $menu->itemCount() > 0) {
                $markup = apply_filters('Municipio/main_menu/items', $menu->render(false));
            }

            return $markup;
        }

        return $menu;
    }
985334
public static function generate()
    {
        self::dispatchEvent(self::EVENT_GET_MENU);

        $return = '';

        // sort menu by it's order
        uksort(self::$menu, 'strnatcmp');;

        /** @var Menu $item */
        foreach (self::$menu as $item) {
            if ($item->resources && !self::userHasResource($item->resources)) {
                continue;
            }

            if ($children = $item->getChildren()) {
                $subItems = '';

                // sort menu by it's order
                uksort($children, 'strnatcmp');;

                /** @var Menu $child */
                foreach ($children as $child) {
                    if ($child->resources && !self::userHasResource($child->resources)) {
                        continue;
                    }

                    $subItems .= '<li><a href="' . $child->getLink() . '">' . $child->getLabel() . '</a></li>';
                }

                $return .= '<li class="treeview">
                  <a href="#">
                    <i class="fa ' . $item->getIcon() . '"></i>
                    <span>' . $item->getLabel() . '</span>
                    <i class="fa fa-angle-left pull-right"></i>
                  </a>
                  <ul class="treeview-menu">
                    ' . $subItems . '
                  </ul>
                </li>';
            } else {
                $return .= '<li>
                        <a href="' . $item->getLink() . '">
                            <i class="fa ' . $item->getIcon() . ' fa-fw"></i> <span>' . $item->getLabel() . '</span>
                        </a>
                    </li>';
            }
        }

        return $return;
    }
220456
@Override
	public Menu getContextMenu() {
		if (menu == null) {
			menu = new Menu();
			menu.addItem(new NewFeatureAction(mapWidget, this));
			menu.addItem(new EditFeatureAction(mapWidget, this));
			menu.addItem(new DeleteFeatureAction(mapWidget, this));
			menu.addItem(new MenuItemSeparator());
			menu.addItem(new DeselectAllAction(mapWidget.getMapModel()));
		}
		return menu;
	}
649823
public function form()
    {
        return Menu::form(function (Form $form) {
            $form->display('id', 'ID');

            $form->select('parent_id', trans('admin.parent_id'))->options(Menu::selectOptions());
            $form->text('title', trans('admin.title'))->rules('required');
            $form->icon('icon', trans('admin.icon'))->default('fa-bars')->help($this->iconHelp());
            $form->text('uri', trans('admin.uri'));
            $form->multipleSelect('roles', trans('admin.roles'))->options(Role::all()->pluck('name', 'id'));
            $form->radio('blank', '加载方式')->options(['0' => 'pjax', '1'=>'no-pjax' ])->default('0');
            $form->display('created_at', trans('admin.created_at'));
            $form->display('updated_at', trans('admin.updated_at'));
        });
    }
1107057
public function getMenu()
    {
        if (!$this->menu) {

            foreach ($this->getAllMenus() as $menu) {
                $menu->configureTopMenu($this);
            }
        }

        return parent::getMenu();
    }
247460
protected function getSelect()
    {
        $html = '<select>';

        if (is_array($this->window['all'])) {
            $html .= $this->getOptionLinks($this->window['all']);
        }

        $html .= '</select>';

        return $html;
    }
598407
public function selectWith(\Zend\Db\Sql\Select $select)
    {
        if ($this->usePaginator === true) {
            return $this->initPaginator($select);
        }

        $this->result = $this->tableGateway->selectWith($select);

        return $this->result;
    }