/**
  * @inheritdoc
  */
 public function install()
 {
     $parentMenuItem = $this->findParent();
     $plugin = $this->findPlugin();
     $menuItem = new Menu();
     $menuItem->setLabel(self::MENU_LABEL);
     $menuItem->setController(self::PLUGIN_NAME);
     $menuItem->setAction('Index');
     $menuItem->setClass(self::MENU_ITEM_CLASS);
     $menuItem->setActive(1);
     $menuItem->setParent($parentMenuItem);
     $menuItem->setPlugin($plugin);
     $menuItem->setPosition(6);
     $this->modelManager->persist($menuItem);
     $this->modelManager->flush();
 }
Exemple #2
0
 /**
  * @param Menu $parent
  */
 public function setParent(Menu $parent)
 {
     $parent->getChildren()->add($this);
     $this->parent = $parent;
 }
Exemple #3
0
 /**
  * @param Menu $parent
  */
 public function setParent(Menu $parent = null)
 {
     // Parent may be null when this menu item should be a main menu item
     if ($parent) {
         $parent->getChildren()->add($this);
     }
     $this->parent = $parent;
 }
 /**
  * @param Menu|null $menuItem
  * @param string $menuLabel
  */
 private function createMenuItemIfItDoesNotExist($menuItem, $menuLabel)
 {
     if ($menuItem instanceof Menu) {
         return;
     }
     $menu = new Menu();
     $menu->setLabel($menuLabel);
     $this->modelManger->persist($menu);
     $this->modelManger->flush();
 }
 /**
  * @param Menu $menuItem
  * @param Plugin $plugin
  */
 private function updateImportExportMenuItem(Menu $menuItem, Plugin $plugin)
 {
     $menuItem->setController(self::SWAG_IMPORT_EXPORT_CONTROLLER);
     $menuItem->setAction(self::SWAG_IMPORT_EXPORT_ACTION);
     $menuItem->setPlugin($plugin);
     $this->modelManager->persist($menuItem);
     $this->modelManager->flush();
 }