private function setRegularListCriteria(NewsCriteria $criteria, Module $module)
    {
        // Filter by default categories
        if (\count($default = StringUtil::deserialize($module->news_filterDefault, true)) > 0) {
            $criteria->setDefaultCategories($default);
        }

        // Filter by multiple active categories
        if ($module->news_filterCategoriesCumulative) {
            /** @var Input $input */
            $input = $this->framework->getAdapter(Input::class);
            $param = $this->manager->getParameterName();

            if ($aliases = $input->get($param)) {
                $aliases = StringUtil::trimsplit(CumulativeFilterModule::getCategorySeparator(), $aliases);
                $aliases = array_unique(array_filter($aliases));

                if (count($aliases) > 0) {
                    /** @var NewsCategoryModel $model */
                    $model = $this->framework->getAdapter(NewsCategoryModel::class);

                    foreach ($aliases as $alias) {
                        // Return null if the category does not exist
                        if (null === ($category = $model->findPublishedByIdOrAlias($alias))) {
                            throw new CategoryNotFoundException(sprintf('News category "%s" was not found', $alias));
                        }

                        $criteria->setCategory($category->id, (bool) $module->news_filterPreserve, (bool) $module->news_includeSubcategories);
                    }
                }
            }

            return;
        }

        // Filter by active category
        if ($module->news_filterCategories) {
            /** @var Input $input */
            $input = $this->framework->getAdapter(Input::class);
            $param = $this->manager->getParameterName();

            if ($alias = $input->get($param)) {
                /** @var NewsCategoryModel $model */
                $model = $this->framework->getAdapter(NewsCategoryModel::class);

                // Return null if the category does not exist
                if (null === ($category = $model->findPublishedByIdOrAlias($alias))) {
                    throw new CategoryNotFoundException(sprintf('News category "%s" was not found', $alias));
                }

                $criteria->setCategory($category->id, (bool) $module->news_filterPreserve, (bool) $module->news_includeSubcategories);
            }
        }
    }
private function setRegularListCriteria(NewsCriteria $criteria, Module $module)
    {
        // Filter by default categories
        if (\count($default = StringUtil::deserialize($module->news_filterDefault, true)) > 0) {
            $criteria->setDefaultCategories($default);
        }

        // Filter by multiple active categories
        if ($module->news_filterCategoriesCumulative) {
            /** @var Input $input */
            $input = $this->framework->getAdapter(Input::class);
            $param = $this->manager->getParameterName();

            if ($aliases = $input->get($param)) {
                $aliases = StringUtil::trimsplit(CumulativeFilterModule::getCategorySeparator(), $aliases);
                $aliases = array_unique(array_filter($aliases));

                if (count($aliases) > 0) {
                    /** @var NewsCategoryModel $model */
                    $model = $this->framework->getAdapter(NewsCategoryModel::class);

                    foreach ($aliases as $alias) {
                        // Return null if the category does not exist
                        if (null === ($category = $model->findPublishedByIdOrAlias($alias))) {
                            throw new CategoryNotFoundException(sprintf('News category "%s" was not found', $alias));
                        }

                        $criteria->setCategory($category->id, (bool) $module->news_filterPreserve, (bool) $module->news_includeSubcategories);
                    }
                }
            }

            return;
        }

        // Filter by active category
        if ($module->news_filterCategories) {
            /** @var Input $input */
            $input = $this->framework->getAdapter(Input::class);
            $param = $this->manager->getParameterName();

            if ($alias = $input->get($param)) {
                /** @var NewsCategoryModel $model */
                $model = $this->framework->getAdapter(NewsCategoryModel::class);

                // Return null if the category does not exist
                if (null === ($category = $model->findPublishedByIdOrAlias($alias))) {
                    throw new CategoryNotFoundException(sprintf('News category "%s" was not found', $alias));
                }

                $criteria->setCategory($category->id, (bool) $module->news_filterPreserve, (bool) $module->news_includeSubcategories);
            }
        }
    }
private function setRegularListCriteria ( NewsCriteria $ criteria , Module $ module ) { // Filter by default categories if ( \ count ( $ default = StringUtil :: deserialize ( $ module -> news_filterDefault , true ) ) > 0 ) { $ criteria -> setDefaultCategories ( $ default ) ; } // Filter by multiple active categories if ( $ module -> news_filterCategoriesCumulative ) { /** @var Input $input */ $ input = $ this -> framework -> getAdapter ( Input :: class ) ; $ param = $ this -> manager -> getParameterName ( ) ; if ( $ aliases = $ input -> get ( $ param ) ) { $ aliases = StringUtil :: trimsplit ( CumulativeFilterModule :: getCategorySeparator ( ) , $ aliases ) ; $ aliases = array_unique ( array_filter ( $ aliases ) ) ; if ( count ( $ aliases ) > 0 ) { /** @var NewsCategoryModel $model */ $ model = $ this -> framework -> getAdapter ( NewsCategoryModel :: class ) ; foreach ( $ aliases as $ alias ) { // Return null if the category does not exist if ( null === ( $ category = $ model -> findPublishedByIdOrAlias ( $ alias ) ) ) { throw new CategoryNotFoundException ( sprintf ( 'News category "%s" was not found' , $ alias ) ) ; } $ criteria -> setCategory ( $ category -> id , ( bool ) $ module -> news_filterPreserve , ( bool ) $ module -> news_includeSubcategories ) ; } } } return ; } // Filter by active category if ( $ module -> news_filterCategories ) { /** @var Input $input */ $ input = $ this -> framework -> getAdapter ( Input :: class ) ; $ param = $ this -> manager -> getParameterName ( ) ; if ( $ alias = $ input -> get ( $ param ) ) { /** @var NewsCategoryModel $model */ $ model = $ this -> framework -> getAdapter ( NewsCategoryModel :: class ) ; // Return null if the category does not exist if ( null === ( $ category = $ model -> findPublishedByIdOrAlias ( $ alias ) ) ) { throw new CategoryNotFoundException ( sprintf ( 'News category "%s" was not found' , $ alias ) ) ; } $ criteria -> setCategory ( $ category -> id , ( bool ) $ module -> news_filterPreserve , ( bool ) $ module -> news_includeSubcategories ) ; } } }
Set the regular list criteria.

@param NewsCriteria $criteria
@param Module       $module

@throws CategoryNotFoundException
@throws NoNewsException
Set the regular list criteria .