This function create a correct menu sub itam object for the menu.
193513
def core__generate_menu_sub_item key, values, module_name
      menu_sub_item = {}
      menu_sub_item[:key] = key
      menu_sub_item[:title] = values[:title] ? core__get_menu_title_translation(values[:title], module_name) : 'Undefined'
      menu_sub_item[:url] = values[:url] ? values[:url] : ''
      menu_sub_item[:permission_min] = values[:permission_min] ? values[:permission_min] : 0
      menu_sub_item[:permission_max] = values[:permission_max] ? values[:permission_max] : 999
      return menu_sub_item
    end
953146
def create_assign_context_menu(self):
        
        menu = QMenu("AutoKey")
        self._build_menu(menu)
        self.setContextMenu(menu)
385272
def create_menu(self):
        
        # setup menu
        menu = QtWidgets.QMenu(self.editor)
        menu.setTitle(_('Select'))
        menu.menuAction().setIcon(QtGui.QIcon.fromTheme('edit-select'))
        # setup actions
        menu.addAction(self.action_select_word)
        menu.addAction(self.action_select_extended_word)
        menu.addAction(self.action_select_matched)
        menu.addAction(self.action_select_line)
        menu.addSeparator()
        menu.addAction(self.editor.action_select_all)
        icon = QtGui.QIcon.fromTheme(
            'edit-select-all', QtGui.QIcon(
                ':/pyqode-icons/rc/edit-select-all.png'))
        self.editor.action_select_all.setIcon(icon)
        return menu
299616
protected function createAdminMenu(): void
    {
        $menu = $this->menu();
        $events = $this->app->make('events');

        $handlers = [
            UserMenuHandler::class,
            ExtensionMenuHandler::class,
            SettingMenuHandler::class,
        ];

        $menu->add('home')
            ->title(\trans('orchestra/foundation::title.home'))
            ->link($this->handles('orchestra::/'))
            ->icon('home');

        foreach ($handlers as $handler) {
            $events->listen('orchestra.started: admin', $handler);
        }
    }
986378
private void addMenuItems(Menu mMenu, boolean subMenu) {
        int groupId = R.id.material_drawer_menu_default_group;
        for (int i = 0; i < mMenu.size(); i++) {
            MenuItem mMenuItem = mMenu.getItem(i);
            IDrawerItem iDrawerItem;
            if (!subMenu && mMenuItem.getGroupId() != groupId && mMenuItem.getGroupId() != 0) {
                groupId = mMenuItem.getGroupId();
                iDrawerItem = new DividerDrawerItem();
                getItemAdapter().add(iDrawerItem);
            }
            if (mMenuItem.hasSubMenu()) {
                iDrawerItem = new PrimaryDrawerItem()
                        .withName(mMenuItem.getTitle().toString())
                        .withIcon(mMenuItem.getIcon())
                        .withIdentifier(mMenuItem.getItemId())
                        .withEnabled(mMenuItem.isEnabled())
                        .withSelectable(false);
                getItemAdapter().add(iDrawerItem);
                addMenuItems(mMenuItem.getSubMenu(), true);
            } else if (mMenuItem.getGroupId() != 0 || subMenu) {
                iDrawerItem = new SecondaryDrawerItem()
                        .withName(mMenuItem.getTitle().toString())
                        .withIcon(mMenuItem.getIcon())
                        .withIdentifier(mMenuItem.getItemId())
                        .withEnabled(mMenuItem.isEnabled());
                getItemAdapter().add(iDrawerItem);
            } else {
                iDrawerItem = new PrimaryDrawerItem()
                        .withName(mMenuItem.getTitle().toString())
                        .withIcon(mMenuItem.getIcon())
                        .withIdentifier(mMenuItem.getItemId())
                        .withEnabled(mMenuItem.isEnabled());
                getItemAdapter().add(iDrawerItem);
            }
        }
    }
245598
protected function createMenuFile()
    {
        $file = $this->directory.'/menu.php';

        $contents = $this->getStub('menu');
        $this->laravel['files']->put($file, $contents);
        $this->line('<info>Menu file was created:</info> '.str_replace(base_path(), '', $file));
    }
487549
public void addMenuItem(SubMenuItem parent, MenuItem item) {
        SubMenuItem subMenu = (parent != null) ? parent : ROOT;

        synchronized (subMenuItems) {
            ArrayList<MenuItem> subMenuChildren = subMenuItems.computeIfAbsent(subMenu, sm -> new ArrayList<>());
            subMenuChildren.add(item);

            if (item.hasChildren()) {
                subMenuItems.put(item, new ArrayList<>());
            }
        }
    }
1008739
function(menu,ind) {
            
            if (menu instanceof MenuItem) {
                
                if (menu.submenu == null) menu.submenu = new Menu();
                menu = menu.submenu;
            }
            
            menu.addItem(this,ind);
            
            return this;
        }
104112
public function createCustom()
    {
        $parentsSelect = Menu::where('menu_type', 2)->pluck('title', 'id')->prepend('-- no parent --', '');
        $roles         = Role::all();

        return view('qa::menus.createCustom', compact('parentsSelect', 'roles'));
    }
583023
def sub_menu(request, page_id):
    """"""
    page = Page.objects.get(id=page_id)
    pages = page.children.all()
    page_languages = settings.PAGE_LANGUAGES
    return render_to_response("admin/basic_cms/page/sub_menu.html", {
        'page': page,
        'pages': pages,
        'page_languages': page_languages,
    }, context_instance=RequestContext(request))
60946
def submenu key, label, &block
      item = CMenuItem.new(key, label)
      @options << item
      item.action = PromptMenu.new @caller, label, &block
    end
264574
def _create_menu(self):
        
        DEBUG_MSG("_create_menu()", 1, self)
        self._menu = MenuButtonWx(self)
        self.AddControl(self._menu)
        self.AddSeparator()
1164706
public static SubMenuItem asSubMenu(MenuItem item) {
        return visitWithResult(item, new AbstractMenuItemVisitor<SubMenuItem>() {
            @Override
            public void visit(SubMenuItem item) {
                setResult(item);
            }

            @Override
            public void anyItem(MenuItem item) { /* ignored */ }
        }).orElse(null);
    }
828638
def get_menu(self, name):
        """"""
        if name not in self._menus:
            self._menus[name] = self.menuBar().addMenu(name)
        return self._menus[name]
590770
def add_to_submenu(self, submenu_path, item):
        ''''''
        if len(submenu_path) == 0:
            self.add(item)
            return
        for m in self.items:
            if isinstance(m, MPMenuSubMenu) and submenu_path[0] == m.name:
                m.add_to_submenu(submenu_path[1:], item)
                return
        self.add(MPMenuSubMenu(submenu_path[0], []))
        self.add_to_submenu(submenu_path, item)
213314
public Menu add(Menu m) {
        submenus.add(m);
        m.setParent(this);
        return m;
    }
979291
def menu_tree mt, pm = self
      mt.each_pair { |ch, code| 
        if code.is_a? Canis::MenuTree
          item = pm.add(ch, code.value, "") 
          current = PromptMenu.new @caller, code.value
          item.action = current
          menu_tree code, current
        else
          item = pm.add(ch, code.to_s, "", code) 
        end
      }
    end