Sulu\Bundle\AdminBundle\Navigation\NavigationItem::setAction PHP Method

setAction() public method

Sets the action of the NavigationItem.
public setAction ( string $action )
$action string The action of the NavigationItem
    public function setAction($action)
    {
        $this->action = $action;
    }

Usage Example

Example #1
0
 public function __construct(WebspaceManagerInterface $webspaceManager, SecurityCheckerInterface $securityChecker, SessionManagerInterface $sessionManager, $title)
 {
     $this->webspaceManager = $webspaceManager;
     $this->securityChecker = $securityChecker;
     $this->sessionManager = $sessionManager;
     $rootNavigationItem = new NavigationItem($title);
     $section = new NavigationItem('navigation.webspaces');
     $rootNavigationItem->addChild($section);
     /** @var Webspace $webspace */
     foreach ($this->webspaceManager->getWebspaceCollection() as $webspace) {
         if ($this->securityChecker->hasPermission(self::SECURITY_CONTEXT_PREFIX . $webspace->getKey(), 'view')) {
             $webspaceItem = new NavigationItem($webspace->getName());
             $webspaceItem->setIcon('bullseye');
             $indexUuid = $this->sessionManager->getContentNode($webspace->getKey())->getIdentifier();
             $indexPageItem = new NavigationItem('navigation.webspaces.index-page');
             $indexPageItem->setAction('content/contents/' . $webspace->getKey() . '/edit:' . $indexUuid . '/details');
             $webspaceItem->addChild($indexPageItem);
             $contentItem = new NavigationItem('navigation.webspaces.content');
             $contentItem->setAction('content/contents/' . $webspace->getKey());
             $webspaceItem->addChild($contentItem);
             $section->addChild($webspaceItem);
         }
     }
     $this->setNavigation(new Navigation($rootNavigationItem));
 }
All Usage Examples Of Sulu\Bundle\AdminBundle\Navigation\NavigationItem::setAction