public function viewSectionContentAction(Section $section, int $page = 1, int $limit = 10): Response
    {
        $sectionContentAssignForm = $this->formFactory->assignContentSectionForm(
            new SectionContentAssignData($section)
        )->createView();

        $query = new Query();
        $query->sortClauses[] = new SortClause\ContentName(Query::SORT_ASC);
        $query->filter = new Query\Criterion\SectionId([
            $section->id,
        ]);

        $pagerfanta = new Pagerfanta(new ContentSearchAdapter($query, $this->searchService));
        $pagerfanta->setMaxPerPage($limit);
        $pagerfanta->setCurrentPage($page);

        $assignedContent = [];
        foreach ($pagerfanta as $content) {
            $assignedContent[] = [
                'id' => $content->id,
                'name' => $content->getName(),
                'type' => $content->getContentType()->getName(),
                'path' => $this->pathService->loadPathLocations(
                    $this->locationService->loadLocation($content->contentInfo->mainLocationId)
                ),
            ];
        }

        $routeGenerator = function ($page) use ($section) {
            return $this->generateUrl('ezplatform.section.view', [
                'sectionId' => $section->id,
                'page' => $page,
            ]);
        };

        $pagination = (new EzPagerfantaView(new EzPagerfantaTemplate($this->translator)))->render($pagerfanta, $routeGenerator);

        return $this->render('@ezdesign/admin/section/assigned_content.html.twig', [
            'section' => $section,
            'form_section_content_assign' => $sectionContentAssignForm,
            'assigned_content' => $assignedContent,
            'pagerfanta' => $pagerfanta,
            'pagination' => $pagination,
            'can_assign' => $this->canUserAssignSectionToSomeContent($section),
        ]);
    }
public function viewSectionContentAction(Section $section, int $page = 1, int $limit = 10): Response
    {
        $sectionContentAssignForm = $this->formFactory->assignContentSectionForm(
            new SectionContentAssignData($section)
        )->createView();

        $query = new Query();
        $query->sortClauses[] = new SortClause\ContentName(Query::SORT_ASC);
        $query->filter = new Query\Criterion\SectionId([
            $section->id,
        ]);

        $pagerfanta = new Pagerfanta(new ContentSearchAdapter($query, $this->searchService));
        $pagerfanta->setMaxPerPage($limit);
        $pagerfanta->setCurrentPage($page);

        $assignedContent = [];
        foreach ($pagerfanta as $content) {
            $assignedContent[] = [
                'id' => $content->id,
                'name' => $content->getName(),
                'type' => $content->getContentType()->getName(),
                'path' => $this->pathService->loadPathLocations(
                    $this->locationService->loadLocation($content->contentInfo->mainLocationId)
                ),
            ];
        }

        $routeGenerator = function ($page) use ($section) {
            return $this->generateUrl('ezplatform.section.view', [
                'sectionId' => $section->id,
                'page' => $page,
            ]);
        };

        $pagination = (new EzPagerfantaView(new EzPagerfantaTemplate($this->translator)))->render($pagerfanta, $routeGenerator);

        return $this->render('@ezdesign/admin/section/assigned_content.html.twig', [
            'section' => $section,
            'form_section_content_assign' => $sectionContentAssignForm,
            'assigned_content' => $assignedContent,
            'pagerfanta' => $pagerfanta,
            'pagination' => $pagination,
            'can_assign' => $this->canUserAssignSectionToSomeContent($section),
        ]);
    }
public function viewSectionContentAction ( Section $ section , int $ page = 1 , int $ limit = 10 ) : Response { $ sectionContentAssignForm = $ this -> formFactory -> assignContentSectionForm ( new SectionContentAssignData ( $ section ) ) -> createView ( ) ; $ query = new Query ( ) ; $ query -> sortClauses [ ] = new SortClause \ ContentName ( Query :: SORT_ASC ) ; $ query -> filter = new Query \ Criterion \ SectionId ( [ $ section -> id , ] ) ; $ pagerfanta = new Pagerfanta ( new ContentSearchAdapter ( $ query , $ this -> searchService ) ) ; $ pagerfanta -> setMaxPerPage ( $ limit ) ; $ pagerfanta -> setCurrentPage ( $ page ) ; $ assignedContent = [ ] ; foreach ( $ pagerfanta as $ content ) { $ assignedContent [ ] = [ 'id' => $ content -> id , 'name' => $ content -> getName ( ) , 'type' => $ content -> getContentType ( ) -> getName ( ) , 'path' => $ this -> pathService -> loadPathLocations ( $ this -> locationService -> loadLocation ( $ content -> contentInfo -> mainLocationId ) ) , ] ; } $ routeGenerator = function ( $ page ) use ( $ section ) { return $ this -> generateUrl ( 'ezplatform.section.view' , [ 'sectionId' => $ section -> id , 'page' => $ page , ] ) ; } ; $ pagination = ( new EzPagerfantaView ( new EzPagerfantaTemplate ( $ this -> translator ) ) ) -> render ( $ pagerfanta , $ routeGenerator ) ; return $ this -> render ( '@ezdesign/admin/section/assigned_content.html.twig' , [ 'section' => $ section , 'form_section_content_assign' => $ sectionContentAssignForm , 'assigned_content' => $ assignedContent , 'pagerfanta' => $ pagerfanta , 'pagination' => $ pagination , 'can_assign' => $ this -> canUserAssignSectionToSomeContent ( $ section ) , ] ) ; }
Fragment action which renders list of contents assigned to section.

@param \eZ\Publish\API\Repository\Values\Content\Section $section
@param int $page Current page
@param int $limit Number of items per page

@return \Symfony\Component\HttpFoundation\Response

@throws \eZ\Publish\API\Repository\Exceptions\NotFoundException
@throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException
@throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException
Fragment action which renders list of contents assigned to section .