public function action($contentTypeSlug, ListingOptions $options)
    {
        // Order has to be set carefully. Either set it explicitly when the user
        // sorts, or fall back to what's defined in the ContentType. Except for
        // a ContentType that has a "grouping taxonomy", as that should override
        // it. That exception state is handled by the query OrderHandler.
        $contentType = $this->em->getContentType($contentTypeSlug);
        $contentParameters = [
            'paging'  => true,
            'hydrate' => true,
            'order'   => $options->getOrder() ?: $contentType['sort'],
            'page'    => $options->getPage(),
            'filter'  => $options->getFilter(),
            'status'  => $options->getStatus(),
        ];

        // If we have a text filter we switch the query into search mode
        if ($options->getFilter()) {
            $textQuery = $contentTypeSlug . '/search';
            $contentParameters['invisible'] = true;
        } else {
            $textQuery = $contentTypeSlug;
        }

        // Set the amount of items to show per page
        if (!empty($contentType['recordsperpage'])) {
            $contentParameters['limit'] = $contentType['recordsperpage'];
        } else {
            $contentParameters['limit'] = $this->config->get('general/recordsperpage');
        }

        // Filter on taxonomies
        if ($options->getTaxonomies() !== null) {
            foreach ($options->getTaxonomies() as $taxonomy => $value) {
                $contentParameters[$taxonomy] = $value;
            }
        }

        return $this->getContent($textQuery, $contentParameters, $options);
    }
public function action($contentTypeSlug, ListingOptions $options)
    {
        // Order has to be set carefully. Either set it explicitly when the user
        // sorts, or fall back to what's defined in the ContentType. Except for
        // a ContentType that has a "grouping taxonomy", as that should override
        // it. That exception state is handled by the query OrderHandler.
        $contentType = $this->em->getContentType($contentTypeSlug);
        $contentParameters = [
            'paging'  => true,
            'hydrate' => true,
            'order'   => $options->getOrder() ?: $contentType['sort'],
            'page'    => $options->getPage(),
            'filter'  => $options->getFilter(),
            'status'  => $options->getStatus(),
        ];

        // If we have a text filter we switch the query into search mode
        if ($options->getFilter()) {
            $textQuery = $contentTypeSlug . '/search';
            $contentParameters['invisible'] = true;
        } else {
            $textQuery = $contentTypeSlug;
        }

        // Set the amount of items to show per page
        if (!empty($contentType['recordsperpage'])) {
            $contentParameters['limit'] = $contentType['recordsperpage'];
        } else {
            $contentParameters['limit'] = $this->config->get('general/recordsperpage');
        }

        // Filter on taxonomies
        if ($options->getTaxonomies() !== null) {
            foreach ($options->getTaxonomies() as $taxonomy => $value) {
                $contentParameters[$taxonomy] = $value;
            }
        }

        return $this->getContent($textQuery, $contentParameters, $options);
    }
public function action ( $ contentTypeSlug , ListingOptions $ options ) { // Order has to be set carefully. Either set it explicitly when the user // sorts, or fall back to what's defined in the ContentType. Except for // a ContentType that has a "grouping taxonomy", as that should override // it. That exception state is handled by the query OrderHandler. $ contentType = $ this -> em -> getContentType ( $ contentTypeSlug ) ; $ contentParameters = [ 'paging' => true , 'hydrate' => true , 'order' => $ options -> getOrder ( ) ? : $ contentType [ 'sort' ] , 'page' => $ options -> getPage ( ) , 'filter' => $ options -> getFilter ( ) , 'status' => $ options -> getStatus ( ) , ] ; // If we have a text filter we switch the query into search mode if ( $ options -> getFilter ( ) ) { $ textQuery = $ contentTypeSlug . '/search' ; $ contentParameters [ 'invisible' ] = true ; } else { $ textQuery = $ contentTypeSlug ; } // Set the amount of items to show per page if ( ! empty ( $ contentType [ 'recordsperpage' ] ) ) { $ contentParameters [ 'limit' ] = $ contentType [ 'recordsperpage' ] ; } else { $ contentParameters [ 'limit' ] = $ this -> config -> get ( 'general/recordsperpage' ) ; } // Filter on taxonomies if ( $ options -> getTaxonomies ( ) !== null ) { foreach ( $ options -> getTaxonomies ( ) as $ taxonomy => $ value ) { $ contentParameters [ $ taxonomy ] = $ value ; } } return $ this -> getContent ( $ textQuery , $ contentParameters , $ options ) ; }
Fetch a listing of ContentType records.

@param string         $contentTypeSlug
@param ListingOptions $options

@return Content|false
Fetch a listing of ContentType records .