/** * Handle the command. * * @return string */ public function handle(GroupRepositoryInterface $groups, Factory $view) { if (!($group = $groups->findBySlug($this->group))) { return null; } $options = $this->options; $links = $group->getLinks(); $this->dispatch(new RemoveRolesLinks($links)); $this->dispatch(new SetCurrentLink($links)); $this->dispatch(new SetActiveLinks($links)); return $view->make(array_get($options, 'view', 'anomaly.module.navigation::links'), compact('group', 'links', 'options'))->render(); }
/** * Handle the command. * * @param GroupRepositoryInterface $groups * @return GroupInterface|null */ public function handle(GroupRepositoryInterface $groups) { if (is_numeric($this->identifier)) { return $groups->find($this->identifier); } if (is_string($this->identifier)) { return $groups->findBySlug($this->identifier); } if ($this->identifier instanceof Presenter) { return $this->identifier->getObject(); } if (is_object($this->identifier)) { return $this->identifier; } return null; }
/** * Return the form for editing an existing link. * * @param LinkFormBuilder $link * @param EntryFormBuilder $form * @param LinkRepositoryInterface $links * @param GroupRepositoryInterface $groups * @param $group * @param $id * @return \Symfony\Component\HttpFoundation\Response */ public function edit(LinkFormBuilder $link, EntryFormBuilder $form, LinkRepositoryInterface $links, GroupRepositoryInterface $groups, $group, $id) { /* @var LinkInterface $entry */ $entry = $links->find($id); $type = $entry->getType(); $form->addForm('type', $type->builder()->setEntry($entry->getEntry()->getId())); $form->addForm('link', $link->setEntry($id)->setType($entry->getType())->setGroup($group = $groups->findBySlug($group))); $this->breadcrumbs->add($group->getName(), 'admin/navigation/links/' . $group->getSlug()); return $form->render(); }