コード例 #1
0
 /**
  * {@inheritdoc}
  */
 protected function configureSideMenu(MenuItemInterface $menu, $action, AdminInterface $childAdmin = null)
 {
     if (!$childAdmin && !in_array($action, array('edit'))) {
         return;
     }
     $admin = $this->isChild() ? $this->getParent() : $this;
     $id = $admin->getRequest()->get('id');
     $menu->addChild($this->trans('sidemenu.link_edit_work'), array('uri' => $admin->generateUrl('edit', array('id' => $id))));
     if ($this->hasSubject() && $this->getSubject()->getId() !== null) {
         $menu->addChild($this->trans('sidemenu.link_view_work'), array('uri' => $admin->getRouteGenerator()->generate('nz_portfolio_view', array('permalink' => $this->permalinkGenerator->generate($this->getSubject())))));
     }
 }
コード例 #2
0
 /**
  * @param \Nz\PortfolioBundle\Model\WorkInterface
  *
  * @return string|Exception
  */
 public function generatePermalink(WorkInterface $work)
 {
     return $this->permalinkGenerator->generate($work);
 }