/** * @return \Symfony\Component\HttpFoundation\Response */ public function createAction(Request $request = null) { if (!$this->admin->isGranted('CREATE')) { throw new AccessDeniedException(); } $sharedBlockAdminClass = $this->container->getParameter('sonata.page.admin.shared_block.class'); if (!$this->admin->getParent() && get_class($this->admin) !== $sharedBlockAdminClass) { throw new PageNotFoundException('You cannot create a block without a page'); } $sitesPool = $this->get('orangegate.site.pool'); $sites = $sitesPool->getSites(); $currentSite = $sitesPool->getCurrentSite($request, $sites); $parameters = $this->admin->getPersistentParameters(); if (!$parameters['type']) { return $this->render('SonataPageBundle:BlockAdmin:select_type.html.twig', array('services' => $this->get('sonata.block.manager')->getServicesByContext('sonata_page_bundle'), 'base_template' => $this->getBaseTemplate(), 'admin' => $this->admin, 'sites' => $sites, 'currentSite' => $currentSite, 'action' => 'create')); } return parent::createAction(); }