/** * @param \ViKon\Menu\Component\AbstractComponent $component * * @return $this */ public function addComponent(AbstractComponent $component) { $component->setMenuBuilder($this); $component->setContainer($this->container); $this->components[$component->getToken()] = $component; return $this; }
/** * @param \ViKon\Menu\Component\AbstractComponent $component * * @return bool */ public function authenticate(AbstractComponent $component) { if ($component instanceof NestableComponent) { foreach ($component->getNestedComponents() as $nestedComponent) { if ($nestedComponent->isAvailable() === true) { return true; } } return false; } return true; }
/** * @param \ViKon\Menu\Component\AbstractComponent $nestedComponent * * @return $this */ public function addNestedComponent(AbstractComponent $nestedComponent) { $this->nestedComponents[$nestedComponent->getToken()] = $nestedComponent; /** @type \ViKon\Menu\Component\AbstractComponent $this */ if ($this->getMenuBuilder() !== null) { $nestedComponent->setMenuBuilder($this->getMenuBuilder()); } if ($this->getContainer() !== null) { $nestedComponent->setContainer($this->getContainer()); } return $this; }