protected function getCategories()
    {
        $customCategories = $this->news_customCategories ? StringUtil::deserialize($this->news_categories, true) : [];

        // Get the subcategories of custom categories
        if (\count($customCategories) > 0) {
            $customCategories = NewsCategoryModel::getAllSubcategoriesIds($customCategories);
        }

        // Get all categories whether they have news or not
        if ($this->news_showEmptyCategories) {
            if (\count($customCategories) > 0) {
                $categories = NewsCategoryModel::findPublishedByIds($customCategories);
            } else {
                $categories = NewsCategoryModel::findPublished();
            }
        } else {
            // Get the categories that do have news assigned
            $categories = NewsCategoryModel::findPublishedByArchives($this->news_archives, $customCategories);
        }

        return $categories;
    }
protected function getCategories()
    {
        $customCategories = $this->news_customCategories ? StringUtil::deserialize($this->news_categories, true) : [];

        // Get the subcategories of custom categories
        if (\count($customCategories) > 0) {
            $customCategories = NewsCategoryModel::getAllSubcategoriesIds($customCategories);
        }

        // Get all categories whether they have news or not
        if ($this->news_showEmptyCategories) {
            if (\count($customCategories) > 0) {
                $categories = NewsCategoryModel::findPublishedByIds($customCategories);
            } else {
                $categories = NewsCategoryModel::findPublished();
            }
        } else {
            // Get the categories that do have news assigned
            $categories = NewsCategoryModel::findPublishedByArchives($this->news_archives, $customCategories);
        }

        return $categories;
    }
protected function getCategories ( ) { $ customCategories = $ this -> news_customCategories ? StringUtil :: deserialize ( $ this -> news_categories , true ) : [ ] ; // Get the subcategories of custom categories if ( \ count ( $ customCategories ) > 0 ) { $ customCategories = NewsCategoryModel :: getAllSubcategoriesIds ( $ customCategories ) ; } // Get all categories whether they have news or not if ( $ this -> news_showEmptyCategories ) { if ( \ count ( $ customCategories ) > 0 ) { $ categories = NewsCategoryModel :: findPublishedByIds ( $ customCategories ) ; } else { $ categories = NewsCategoryModel :: findPublished ( ) ; } } else { // Get the categories that do have news assigned $ categories = NewsCategoryModel :: findPublishedByArchives ( $ this -> news_archives , $ customCategories ) ; } return $ categories ; }
Get the categories

@return Collection|null
Get the categories