protected function getMenuItemsFromEvent(string $menuName, array $modules = [], $subject = null): MenuInterface
    {
        if (empty($subject)) {
            $subject = $this;
        }

        $event = new Event((string)EventName::GET_MENU_ITEMS(), $subject, [
            'name' => $menuName,
            'user' => $this->user,
            'fullBaseUrl' => $this->fullBaseUrl,
            'modules' => $modules
        ]);
        $this->getEventManager()->dispatch($event);

        return ($event->result instanceof MenuInterface) ? $event->result : new Menu();
    }
protected function getMenuItemsFromEvent(string $menuName, array $modules = [], $subject = null): MenuInterface
    {
        if (empty($subject)) {
            $subject = $this;
        }

        $event = new Event((string)EventName::GET_MENU_ITEMS(), $subject, [
            'name' => $menuName,
            'user' => $this->user,
            'fullBaseUrl' => $this->fullBaseUrl,
            'modules' => $modules
        ]);
        $this->getEventManager()->dispatch($event);

        return ($event->result instanceof MenuInterface) ? $event->result : new Menu();
    }
protected function getMenuItemsFromEvent ( string $ menuName , array $ modules = [ ] , $ subject = null ) : MenuInterface { if ( empty ( $ subject ) ) { $ subject = $ this ; } $ event = new Event ( ( string ) EventName :: GET_MENU_ITEMS ( ) , $ subject , [ 'name' => $ menuName , 'user' => $ this -> user , 'fullBaseUrl' => $ this -> fullBaseUrl , 'modules' => $ modules ] ) ; $ this -> getEventManager ( ) -> dispatch ( $ event ) ; return ( $ event -> result instanceof MenuInterface ) ? $ event -> result : new Menu ( ) ; }
Menu items getter using Event.

@param string $menuName Menu name
@param mixed[] $modules Modules to fetch menu items for
@param null|mixed $subject Event subject to be used. $this will be used in null
@return \Menu\MenuBuilder\MenuInterface
Menu items getter using Event .