src/Admin/Menu.php
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;
    }
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;
    }
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 ; }
Generate menu, it's only used in this bundle!

@return string Menu HTML code

@todo return must be array, these HTML codes may be in twig template
Generate menu it s only used in this bundle!