bundle/Controller/FullViewController.php
public function viewNgCategory(Request $request, ContentView $view, array $params = [])
    {
        $content = $view->getSiteContent();
        $location = $view->getSiteLocation();
        if (!$location instanceof Location) {
            $location = $content->mainLocation;
        }

        $response = $this->checkCategoryRedirect($location);
        if ($response instanceof Response) {
            return $response;
        }

        $criteria = [
            new Criterion\Subtree($location->pathString),
            new Criterion\Visibility(Criterion\Visibility::VISIBLE),
            new Criterion\LogicalNot(new Criterion\LocationId($location->id)),
        ];

        if (!$content->getField('fetch_subtree')->value->bool) {
            $criteria[] = new Criterion\Location\Depth(Criterion\Operator::EQ, $location->depth + 1);
        }

        if (!$content->getField('children_class_filter_include')->isEmpty()) {
            $contentTypeFilter = $content->getField('children_class_filter_include')->value;
            $criteria[] = new Criterion\ContentTypeIdentifier(
                array_map(
                    'trim',
                    explode(',', $contentTypeFilter->text)
                )
            );
        }

        $query = new LocationQuery();
        $query->filter = new Criterion\LogicalAnd($criteria);
        $query->sortClauses = $location->innerLocation->getSortClauses();

        $pager = new Pagerfanta(
            new FilterAdapter(
                $query,
                $this->getSite()->getFilterService()
            )
        );

        $pager->setNormalizeOutOfRangePages(true);

        /** @var \eZ\Publish\Core\FieldType\Integer\Value $pageLimitValue */
        $pageLimitValue = $content->getField('page_limit')->value;

        $defaultLimit = 12;

        $childrenLimit = (int) ($params['childrenLimit'] ?? $defaultLimit);
        $childrenLimit = $childrenLimit > 0 ? $childrenLimit : $defaultLimit;

        $pager->setMaxPerPage($pageLimitValue->value > 0 ? (int) $pageLimitValue->value : $childrenLimit);

        $currentPage = (int) $request->get('page', 1);
        $pager->setCurrentPage($currentPage > 0 ? $currentPage : 1);

        $view->addParameters([
            'pager' => $pager,
        ]);

        return $view;
    }
public function viewNgCategory(Request $request, ContentView $view, array $params = [])
    {
        $content = $view->getSiteContent();
        $location = $view->getSiteLocation();
        if (!$location instanceof Location) {
            $location = $content->mainLocation;
        }

        $response = $this->checkCategoryRedirect($location);
        if ($response instanceof Response) {
            return $response;
        }

        $criteria = [
            new Criterion\Subtree($location->pathString),
            new Criterion\Visibility(Criterion\Visibility::VISIBLE),
            new Criterion\LogicalNot(new Criterion\LocationId($location->id)),
        ];

        if (!$content->getField('fetch_subtree')->value->bool) {
            $criteria[] = new Criterion\Location\Depth(Criterion\Operator::EQ, $location->depth + 1);
        }

        if (!$content->getField('children_class_filter_include')->isEmpty()) {
            $contentTypeFilter = $content->getField('children_class_filter_include')->value;
            $criteria[] = new Criterion\ContentTypeIdentifier(
                array_map(
                    'trim',
                    explode(',', $contentTypeFilter->text)
                )
            );
        }

        $query = new LocationQuery();
        $query->filter = new Criterion\LogicalAnd($criteria);
        $query->sortClauses = $location->innerLocation->getSortClauses();

        $pager = new Pagerfanta(
            new FilterAdapter(
                $query,
                $this->getSite()->getFilterService()
            )
        );

        $pager->setNormalizeOutOfRangePages(true);

        /** @var \eZ\Publish\Core\FieldType\Integer\Value $pageLimitValue */
        $pageLimitValue = $content->getField('page_limit')->value;

        $defaultLimit = 12;

        $childrenLimit = (int) ($params['childrenLimit'] ?? $defaultLimit);
        $childrenLimit = $childrenLimit > 0 ? $childrenLimit : $defaultLimit;

        $pager->setMaxPerPage($pageLimitValue->value > 0 ? (int) $pageLimitValue->value : $childrenLimit);

        $currentPage = (int) $request->get('page', 1);
        $pager->setCurrentPage($currentPage > 0 ? $currentPage : 1);

        $view->addParameters([
            'pager' => $pager,
        ]);

        return $view;
    }
public function viewNgCategory ( Request $ request , ContentView $ view , array $ params = [ ] ) { $ content = $ view -> getSiteContent ( ) ; $ location = $ view -> getSiteLocation ( ) ; if ( ! $ location instanceof Location ) { $ location = $ content -> mainLocation ; } $ response = $ this -> checkCategoryRedirect ( $ location ) ; if ( $ response instanceof Response ) { return $ response ; } $ criteria = [ new Criterion \ Subtree ( $ location -> pathString ) , new Criterion \ Visibility ( Criterion \ Visibility :: VISIBLE ) , new Criterion \ LogicalNot ( new Criterion \ LocationId ( $ location -> id ) ) , ] ; if ( ! $ content -> getField ( 'fetch_subtree' ) -> value -> bool ) { $ criteria [ ] = new Criterion \ Location \ Depth ( Criterion \ Operator :: EQ , $ location -> depth + 1 ) ; } if ( ! $ content -> getField ( 'children_class_filter_include' ) -> isEmpty ( ) ) { $ contentTypeFilter = $ content -> getField ( 'children_class_filter_include' ) -> value ; $ criteria [ ] = new Criterion \ ContentTypeIdentifier ( array_map ( 'trim' , explode ( ',' , $ contentTypeFilter -> text ) ) ) ; } $ query = new LocationQuery ( ) ; $ query -> filter = new Criterion \ LogicalAnd ( $ criteria ) ; $ query -> sortClauses = $ location -> innerLocation -> getSortClauses ( ) ; $ pager = new Pagerfanta ( new FilterAdapter ( $ query , $ this -> getSite ( ) -> getFilterService ( ) ) ) ; $ pager -> setNormalizeOutOfRangePages ( true ) ; /** @var \eZ\Publish\Core\FieldType\Integer\Value $pageLimitValue */ $ pageLimitValue = $ content -> getField ( 'page_limit' ) -> value ; $ defaultLimit = 12 ; $ childrenLimit = ( int ) ( $ params [ 'childrenLimit' ] ?? $ defaultLimit ) ; $ childrenLimit = $ childrenLimit > 0 ? $ childrenLimit : $ defaultLimit ; $ pager -> setMaxPerPage ( $ pageLimitValue -> value > 0 ? ( int ) $ pageLimitValue -> value : $ childrenLimit ) ; $ currentPage = ( int ) $ request -> get ( 'page' , 1 ) ; $ pager -> setCurrentPage ( $ currentPage > 0 ? $ currentPage : 1 ) ; $ view -> addParameters ( [ 'pager' => $ pager , ] ) ; return $ view ; }
Action for viewing content with ng_category content type identifier.

@return \Symfony\Component\HttpFoundation\Response|\Netgen\Bundle\EzPlatformSiteApiBundle\View\ContentView
Action for viewing content with ng_category content type identifier .