lib/Collection/QueryType/Handler/Traits/ContentTypeFilterTrait.php
private function getContentTypeFilterCriteria(ParameterCollectionInterface $parameterCollection): ?Criterion
    {
        if ($parameterCollection->getParameter('filter_by_content_type')->getValue() !== true) {
            return null;
        }

        $contentTypes = $parameterCollection->getParameter('content_types')->getValue() ?? [];
        if (count($contentTypes) === 0) {
            return null;
        }

        $contentTypeFilter = new Criterion\ContentTypeId(
            $this->getContentTypeIds($contentTypes)
        );

        if ($parameterCollection->getParameter('content_types_filter')->getValue() === 'exclude') {
            $contentTypeFilter = new Criterion\LogicalNot($contentTypeFilter);
        }

        return $contentTypeFilter;
    }
private function getContentTypeFilterCriteria(ParameterCollectionInterface $parameterCollection): ?Criterion
    {
        if ($parameterCollection->getParameter('filter_by_content_type')->getValue() !== true) {
            return null;
        }

        $contentTypes = $parameterCollection->getParameter('content_types')->getValue() ?? [];
        if (count($contentTypes) === 0) {
            return null;
        }

        $contentTypeFilter = new Criterion\ContentTypeId(
            $this->getContentTypeIds($contentTypes)
        );

        if ($parameterCollection->getParameter('content_types_filter')->getValue() === 'exclude') {
            $contentTypeFilter = new Criterion\LogicalNot($contentTypeFilter);
        }

        return $contentTypeFilter;
    }
private function getContentTypeFilterCriteria ( ParameterCollectionInterface $ parameterCollection ) : ? Criterion { if ( $ parameterCollection -> getParameter ( 'filter_by_content_type' ) -> getValue ( ) !== true ) { return null ; } $ contentTypes = $ parameterCollection -> getParameter ( 'content_types' ) -> getValue ( ) ?? [ ] ; if ( count ( $ contentTypes ) === 0 ) { return null ; } $ contentTypeFilter = new Criterion \ ContentTypeId ( $ this -> getContentTypeIds ( $ contentTypes ) ) ; if ( $ parameterCollection -> getParameter ( 'content_types_filter' ) -> getValue ( ) === 'exclude' ) { $ contentTypeFilter = new Criterion \ LogicalNot ( $ contentTypeFilter ) ; } return $ contentTypeFilter ; }
Returns the criteria used to filter content by content type.
Returns the criteria used to filter content by content type .