Ejemplo n.º 1
0
 /**
  * Build by category and place all menu entries inside a family
  *
  * @param NodeInterface $parentNode     Parent menu node
  * @param Plugin[]      $plugins        Plugins
  * @param string        $pluginCategory Plugin category
  *
  * @return $this Self object
  */
 private function buildByPluginCategory(NodeInterface $parentNode, array $plugins, $pluginCategory)
 {
     foreach ($plugins as $plugin) {
         if ($plugin->getCategory() !== $pluginCategory) {
             continue;
         }
         $node = $this->menuNodeFactory->create()->setName($plugin->getConfigurationValue('name'))->setCode($plugin->getConfigurationValue('fa_icon'))->setUrl(['admin_plugin_configure', ['pluginHash' => $plugin->getHash()]])->setEnabled(true);
         $parentNode->addSubnode($node);
     }
     return $this;
 }
Ejemplo n.º 2
0
 /**
  * Filter all disabled nodes
  *
  * @param NodeInterface $menuNode Menu node
  *
  * @return boolean Node must be rendered
  */
 public function filter(NodeInterface $menuNode)
 {
     return $menuNode->isEnabled();
 }
Ejemplo n.º 3
0
 /**
  * Generate node hidration
  *
  * @param NodeInterface $node Node
  *
  * @return array Node hidrated
  */
 public function hidrateNode(NodeInterface $node)
 {
     return ['id' => $node->getId(), 'name' => $node->getName(), 'code' => $node->getCode(), 'url' => $node->getUrl(), 'subnodes' => $this->loadSubnodes($node)];
 }
Ejemplo n.º 4
0
 /**
  * Filter all menus without url that has no children
  *
  * @param NodeInterface $menuNode Menu node
  *
  * @return boolean Node must be rendered
  */
 public function filter(NodeInterface $menuNode)
 {
     return !$menuNode->getSubnodes()->isEmpty() || $menuNode->getUrl();
 }