/** * Returns true if the given section is assigned to contents, or used in role policies, or in role assignments. * * This does not check user permissions. * * @since 6.0 * * @param \eZ\Publish\API\Repository\Values\Content\Section $section * * @return bool */ public function isSectionUsed(Section $section) { return $this->service->isSectionUsed($section); }
/** * Renders the view of a section. * * @param mixed $sectionId * * @return \Symfony\Component\HttpFoundation\Response */ public function viewAction($sectionId) { $section = $this->sectionService->loadSection($sectionId); $deleteForm = $this->createForm(new SectionDeleteType($this->sectionService), ['sectionId' => $sectionId]); return $this->render('eZPlatformUIBundle:Section:view.html.twig', ['section' => $section, 'deleteForm' => $deleteForm->createView(), 'contentCount' => $this->sectionService->countAssignedContents($section), 'deletable' => !$this->sectionService->isSectionUsed($section), 'canEdit' => $this->isGranted(new Attribute('section', 'edit')), 'canAssign' => $this->isGranted(new Attribute('section', 'assign'))]); }