/** * Handle the command. */ public function handle() { if (!($current = $this->links->current())) { return; } if (!$current->getParentId()) { return; } /* @var LinkInterface $link */ foreach ($this->links as $link) { /** * Already flagged. */ if ($link->isActive() || $link->isCurrent()) { continue; } /** * Set active if the direct * parent of current link. */ if ($link->getId() == $current->getParentId()) { $link->setActive(true); } /** * If the active link is in the children * of this link then mark it active too. */ if (!$this->links->children($link)->active()->isEmpty()) { $link->setActive(true); $this->dispatch(new SetActiveLinks($this->links)); } } }
/** * Handle the command. */ public function handle() { $current = $this->links->current(); if (!$current) { return; } //$current->setActive(true); /* @var LinkInterface $link */ foreach ($this->links as $link) { if ($current->getParentId() == $link->getId()) { //$link->setActive(true); } } }