public function showFolderListAction(Request $request, ContentView $view)
    {
        $languages = $this->getConfigResolver()->getParameter('languages');

        // Using the criteria helper (a demobundle custom service) to generate our query's criteria.
        // This is a good practice in order to have less code in your controller.
        $criteria = $this->get('ezdemo.criteria_helper')->generateListFolderCriterion(
            $view->getLocation(),
            $this->container->getParameter('ezdemo.folder.folder_view.excluded_content_types'),
            $languages
        );

        // Generating query
        $query = new LocationQuery();
        $query->query = $criteria;
        $query->sortClauses = array(
            new SortClause\DatePublished(),
        );

        // Initialize pagination.
        $pager = new Pagerfanta(
            new ContentSearchAdapter($query, $this->getRepository()->getSearchService())
        );

        $pager->setMaxPerPage($this->container->getParameter('ezdemo.folder.folder_list.limit'));
        $pager->setCurrentPage($request->get('page', 1));

        $includedContentTypeIdentifiers = $this->container->getParameter('ezdemo.folder.folder_tree.included_content_types');

        // Get sub folder structure
        $subContentCriteria = $this->get('ezdemo.criteria_helper')->generateSubContentCriterion(
            $view->getLocation(), $includedContentTypeIdentifiers, $languages
        );

        $subContentQuery = new LocationQuery();
        $subContentQuery->query = $subContentCriteria;
        $subContentQuery->sortClauses = array(
            new SortClause\ContentName(),
        );

        $searchService = $this->getRepository()->getSearchService();
        $subContent = $searchService->findLocations($subContentQuery);

        $treeItems = array();
        foreach ($subContent->searchHits as $hit) {
            $treeItems[] = $hit->valueObject;
        }

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

        return $view;
    }
public function showFolderListAction(Request $request, ContentView $view)
    {
        $languages = $this->getConfigResolver()->getParameter('languages');

        // Using the criteria helper (a demobundle custom service) to generate our query's criteria.
        // This is a good practice in order to have less code in your controller.
        $criteria = $this->get('ezdemo.criteria_helper')->generateListFolderCriterion(
            $view->getLocation(),
            $this->container->getParameter('ezdemo.folder.folder_view.excluded_content_types'),
            $languages
        );

        // Generating query
        $query = new LocationQuery();
        $query->query = $criteria;
        $query->sortClauses = array(
            new SortClause\DatePublished(),
        );

        // Initialize pagination.
        $pager = new Pagerfanta(
            new ContentSearchAdapter($query, $this->getRepository()->getSearchService())
        );

        $pager->setMaxPerPage($this->container->getParameter('ezdemo.folder.folder_list.limit'));
        $pager->setCurrentPage($request->get('page', 1));

        $includedContentTypeIdentifiers = $this->container->getParameter('ezdemo.folder.folder_tree.included_content_types');

        // Get sub folder structure
        $subContentCriteria = $this->get('ezdemo.criteria_helper')->generateSubContentCriterion(
            $view->getLocation(), $includedContentTypeIdentifiers, $languages
        );

        $subContentQuery = new LocationQuery();
        $subContentQuery->query = $subContentCriteria;
        $subContentQuery->sortClauses = array(
            new SortClause\ContentName(),
        );

        $searchService = $this->getRepository()->getSearchService();
        $subContent = $searchService->findLocations($subContentQuery);

        $treeItems = array();
        foreach ($subContent->searchHits as $hit) {
            $treeItems[] = $hit->valueObject;
        }

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

        return $view;
    }
public function showFolderListAction ( Request $ request , ContentView $ view ) { $ languages = $ this -> getConfigResolver ( ) -> getParameter ( 'languages' ) ; // Using the criteria helper (a demobundle custom service) to generate our query's criteria. // This is a good practice in order to have less code in your controller. $ criteria = $ this -> get ( 'ezdemo.criteria_helper' ) -> generateListFolderCriterion ( $ view -> getLocation ( ) , $ this -> container -> getParameter ( 'ezdemo.folder.folder_view.excluded_content_types' ) , $ languages ) ; // Generating query $ query = new LocationQuery ( ) ; $ query -> query = $ criteria ; $ query -> sortClauses = array ( new SortClause \ DatePublished ( ) , ) ; // Initialize pagination. $ pager = new Pagerfanta ( new ContentSearchAdapter ( $ query , $ this -> getRepository ( ) -> getSearchService ( ) ) ) ; $ pager -> setMaxPerPage ( $ this -> container -> getParameter ( 'ezdemo.folder.folder_list.limit' ) ) ; $ pager -> setCurrentPage ( $ request -> get ( 'page' , 1 ) ) ; $ includedContentTypeIdentifiers = $ this -> container -> getParameter ( 'ezdemo.folder.folder_tree.included_content_types' ) ; // Get sub folder structure $ subContentCriteria = $ this -> get ( 'ezdemo.criteria_helper' ) -> generateSubContentCriterion ( $ view -> getLocation ( ) , $ includedContentTypeIdentifiers , $ languages ) ; $ subContentQuery = new LocationQuery ( ) ; $ subContentQuery -> query = $ subContentCriteria ; $ subContentQuery -> sortClauses = array ( new SortClause \ ContentName ( ) , ) ; $ searchService = $ this -> getRepository ( ) -> getSearchService ( ) ; $ subContent = $ searchService -> findLocations ( $ subContentQuery ) ; $ treeItems = array ( ) ; foreach ( $ subContent -> searchHits as $ hit ) { $ treeItems [ ] = $ hit -> valueObject ; } $ view -> addParameters ( [ 'pagerFolder' => $ pager , 'treeItems' => $ treeItems ] ) ; return $ view ; }
Displays the list of article.

@param \Symfony\Component\HttpFoundation\Request $request request object
@param \eZ\Publish\Core\MVC\Symfony\View\ContentView $view

@return \Symfony\Component\HttpFoundation\Response $location is flagged as invisible
Displays the list of article .