Validates the supplied menu, and returns a boolean value indicating whether or not the menu *should* be a valid
menu according to the API.

@param Menu $menu

@return bool
332548
public function validateMenu (Menu $menu)
    {
        foreach ($menu->getItems() as $item) {
            if (! $this->validateItem($item)) {
                return false;
            }
        }

        return true;
    }
251186
public function delete($menus = array())
    {
        $rst = $this->_request->post($this->_url . 'menu/delete', $menus);
        return $this->_client->rst($rst);
    }
813427
public function store(Menu $menu, MenulinkFormRequest $request)
    {
        $data = $request->all();
        $data['parent_id'] = null;
        $data['page_id'] = $data['page_id'] ?? null;
        $data['position'] = $data['position'] ?? 0;
        $model = $this->repository->create($data);
        Menus::forgetCache();

        return $this->redirect($request, $model);
    }
644047
protected function isElementValid($element) : bool
    {
        return is_a($element, $this->getType()) || is_subclass_of($element, $this->getType());
    }
996731
public static function menuCheck(){

        $uid = self::sessionGet('user.uid');

        if(empty($uid)){
            return false;
        }
        $where['status'] = 1;

        if($uid != 1){
            $authMenu        = self::authMenu('',false);

            if(is_array($authMenu)){
               $where['id']=['in',array_keys($authMenu)];
            }
        }

        $menu       = Menu::where($where)->order(["list_order" => "asc",'id'=>'asc'])->column('*','id');

        return $menu;
    }
667005
public static function isInMenuLinks($categoriesID)
    {
        $isInMenulinks = MenuLink::where('belongsToID', $categoriesID)->where('belongsTo', 'category')->count();
        if ($isInMenulinks) {
            return true;
        }
        return false;
    }
862732
public function validateRole($role)
    {
        $roleValidator = new RoleValidator();
        $response = $roleValidator->validate($role);

        if (!$response) {
            $this->addError('role', 'Role must be a valid instance of Role class - ' . $roleValidator->getErrorsAsString());
        }

        return $response;
    }
1160677
static function verifyMenuConfig($menus)
    {
        $menus = hstcms_hook('s_manage_menu', $menus, true);
        $_menus = [];
        foreach ($menus as $key => $menu)
        {
            if($menu['level'] == 1) {
                $_menus[$key] = ['id'=>$key, 'name'=>$menu['name'], 'icon'=>$menu['icon'], 'parent'=>$menu['parent']];
            } else {
                if($menu['level'] == 2 && !$menu['url']) {
                    $_menus[$menu['parent']]['items'][$key] = ['id'=>$key, 'name'=>$menu['name'], 'parent'=>$menu['parent']];
                } else if($menu['level'] == 3) {
                    if(!preg_match('|^http://|', $menu['url'])) {
                        $menu['url'] = route($menu['url']);
                    }
                    $_menus[$menu['parent']]['items'][$menu['parents']]['items'][$key] = ['id'=>$key, 'name'=>$menu['name'], 'parent'=>$menu['parent'], 'url'=>$menu['url']];
                } else {
                    if(!preg_match('|^http://|', $menu['url'])) {
                        $menu['url'] = route($menu['url']);
                    }
                    $_menus[$menu['parent']]['items'][$key] = ['id'=>$key, 'name'=>$menu['name'], 'parent'=>$menu['parent'], 'url'=>$menu['url']];
                }
            }
        }
        return $_menus;
    }
810633
public function setMenu(MenuNodeInterface $menu = null)
    {
        $this->menu = $menu;

        if ($menu->getNode() !== $this) {
            $menu->setNode($this);
        }

        return $this;
    }
1362806
public function valid($language)
    {
        if (empty($language)) {
            return false;
        }
        if ($language == 'en' || $language == 'de' || $language == 'pl' || $language == 'ru') {
            return true;
        }
        return false;
    }
47768
protected function isValidOption(?string $option): bool
    {
        return in_array($option, $this->getOptions(), true) === true
            || ($this->isRequired() === false && $option === null);
    }
445238
public function canEditMenu(Menu $menu, AccountInterface $account)
    {
        return $account->hasPermission(self::PERM_MANAGE_ALL_MENU) || $this->isUserWebmaster($menu, $account);
    }
863907
public function setMenu($menu){
		$contentSize=\sizeof($this->content);
		for($i=0;$i<$contentSize;$i++){
			if($menu->getItem($i)!==NULL){
				if(isset($this->content[$i])){
					$menu->getItem($i)->addToProperty("data-tab",$this->content[$i]->getProperty("data-tab"));
				}
			}
		}
		$menuSize=$menu->count();
		for($i=0;$i<$menuSize;$i++){
			$menu->getItem($i)->removeProperty("href");
			if(isset($this->content[$i])===false){
				$this->content[$i]=$this->createSegment($i, "New content", $menu->getItem($i)->getIdentifier());
			}
			$menu->getItem($i)->addToProperty("data-tab",$this->content[$i]->getProperty("data-tab"));
		}

		$this->content["menu"]=$menu;
		return $this;
	}
320915
public function itemsAction(Menu $menu)
    {
        $em = $this->getDoctrine()->getManager();
        //$entities = $em->getRepository('FlowcodePageBundle:MenuItem')->findBy(array("menu" => $menu->getId()));
        $entities = $em->getRepository('AmulenPageBundle:MenuItem')->childrenHierarchy(null, false, array(
            "childSort" => array("position" => "ASC"),
        ), null);

        return array(
            'menu' => $menu,
            'entities' => $entities,
        );
    }
727694
public function updateAccountMenu($menu)
    {
        $curr_action = $this
            ->owner
            ->getRequest()
            ->param("Action");
        
        $menu->add(ArrayData::create([
            "ID"    => 1,
            "Title" => _t('Orders.OutstandingOrders', 'Outstanding Orders'),
            "Link"  => $this->owner->Link("outstanding"),
            "LinkingMode" => ($curr_action == "outstanding") ? "current" : "link"
        ]));

        $menu->add(ArrayData::create([
            "ID"    => 2,
            "Title" => _t('Orders.OrderHistory', "Order history"),
            "Link"  => $this->owner->Link("history"),
            "LinkingMode" => ($curr_action == "history") ? "current" : "link"
        ]));
    }
99211
protected function generateMenu($menuBuilder, $menu)
    {
        $subMenu = $this->registerMenu($menuBuilder, $menu);
        $menu->children->each(function (Menu $subItem) use ($subMenu) {
            $subMenuChild = $this->registerMenu($subMenu, $subItem);
            if (count($subItem->children)) {
                $this->generateMenu($subMenuChild, $subItem);
            }
        });
    }
545493
public function setMenu(\Amulen\PageBundle\Entity\Menu $menu = null) {
        $this->menu = $menu;

        return $this;
    }