@param array $displayCategories

@return Endpoint
975658
public function setDisplayCategories($displayCategories) {
		$this->displayCategories = [];

		foreach ($displayCategories as $displayCategory) {
			$this->addDisplayCategory($displayCategory);
		}

		return $this;
	}
1316952
public function getDescendants($parentCategories = null)
    {
        if(empty($parentCategories)) {
            $childCategories = $this->getChildren();
        }
        else {
            $childCategories = Category::find()
                ->where(['in', 'parent_id', ArrayHelper::map($parentCategories, 'id', 'id')])
                ->with('translation')
                ->all();
        }
        if(!empty($childCategories)) {
            return array_merge($childCategories, $this->getDescendants($childCategories));
        }
        return $childCategories;
    }
1112591
private function formatCategories(array $categories) {

    $terms = [];

    foreach ($categories as $cid) {
      $term = $this->categoryRepo->loadCategoryTerm($cid);
      if ($term) {
        $terms[] = $term->id();
      }
    }

    return ($terms);
  }
369132
public function update(DocumentCategory $category)
    {
        $attributes = request()->validate(DocumentCategory::$rules, DocumentCategory::$messages);

        $category = $this->updateEntry($category, $attributes);

        return redirect_to_resource();
    }
902018
public function showCategory($category, $pagenumber = 1)
    {
        if (!$this->category->exists($category)) {
            return \Response::view($this->theme.'.404', array('global' => $this->global), 404);
        }

        $categoryObject = $this->category->getCategory($category);
        $parent = $this->category->getParentCategory($category);
        $subCategories = $this->category->getSubCategories($category);
        $posts = $this->post->getAll($category);

        $viewParamaters = array(
            'global' => $this->global,
            'category' => $categoryObject,
            'parent' => $parent,
            'subCategories' => $subCategories,
            'posts' => $posts,
            'pageNumber' => $pagenumber
        );

        return \View::make($this->theme.'.category', $viewParamaters);
    }
338189
public function show(CategoryRequest $request, Category $category)
    {

        if ($category->exists) {
            $view = 'block::admin.category.show';
        } else {
            $view = 'block::admin.category.new';
        }

        return $this->response->setMetaTitle(trans('app.view') . ' ' . trans('block::category.name'))
            ->data(compact('category'))
            ->view($view)
            ->output();
    }
1181920
public function viewNgCategory(Request $request, ContentView $view, array $params = [])
    {
        $content = $view->getSiteContent();
        $location = $view->getSiteLocation();
        if (!$location instanceof Location) {
            $location = $content->mainLocation;
        }

        $response = $this->checkCategoryRedirect($location);
        if ($response instanceof Response) {
            return $response;
        }

        $criteria = [
            new Criterion\Subtree($location->pathString),
            new Criterion\Visibility(Criterion\Visibility::VISIBLE),
            new Criterion\LogicalNot(new Criterion\LocationId($location->id)),
        ];

        if (!$content->getField('fetch_subtree')->value->bool) {
            $criteria[] = new Criterion\Location\Depth(Criterion\Operator::EQ, $location->depth + 1);
        }

        if (!$content->getField('children_class_filter_include')->isEmpty()) {
            $contentTypeFilter = $content->getField('children_class_filter_include')->value;
            $criteria[] = new Criterion\ContentTypeIdentifier(
                array_map(
                    'trim',
                    explode(',', $contentTypeFilter->text)
                )
            );
        }

        $query = new LocationQuery();
        $query->filter = new Criterion\LogicalAnd($criteria);
        $query->sortClauses = $location->innerLocation->getSortClauses();

        $pager = new Pagerfanta(
            new FilterAdapter(
                $query,
                $this->getSite()->getFilterService()
            )
        );

        $pager->setNormalizeOutOfRangePages(true);

        /** @var \eZ\Publish\Core\FieldType\Integer\Value $pageLimitValue */
        $pageLimitValue = $content->getField('page_limit')->value;

        $defaultLimit = 12;

        $childrenLimit = (int) ($params['childrenLimit'] ?? $defaultLimit);
        $childrenLimit = $childrenLimit > 0 ? $childrenLimit : $defaultLimit;

        $pager->setMaxPerPage($pageLimitValue->value > 0 ? (int) $pageLimitValue->value : $childrenLimit);

        $currentPage = (int) $request->get('page', 1);
        $pager->setCurrentPage($currentPage > 0 ? $currentPage : 1);

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

        return $view;
    }
825225
public function getCategories()
    {
        return (new CmsCategoryQuery)
                ->join('cms_category_relation')->on('id', 'cms_category_id')
                ->where('object', 'cms_category_relation')->equals($this->_object)
                ->where('objectId', 'cms_category_relation')->equals($this->_objectId)
                ->find();
    }
937115
private function getSortedEndpoints($endpoints)
    {
        ksort($endpoints);

        $sorted = array();
        foreach ($endpoints as $key => $val) {
            $this->ins($sorted, explode('.', $key), $val);
        }
        
        return $sorted;
    }
66749
public function removeCategories(Collection $categories)
    {
        foreach ($categories as $category) {
                $this->removeCategory($category);
        }

        return $this;
    }
272433
public function shopCategory(Request $request, $category, $categoryPath, $pagedef)
    {
        $catPath = rtrim($category, '/');
        if ('.html' === substr($catPath, -5) && strlen($catPath) > 5) {
            $catPath = substr($catPath, 0, -5);
        }

        $oPathCat = TdbShopCategoryList::GetCategoryForCategoryPath(explode('/', $catPath));

        if (null !== $oPathCat && true === $oPathCat->AllowDisplayInShop()) {
            $aKey = array(
                'class' => __CLASS__,
                'method' => 'shopCategory',
                'path' => $category,
            );
            $cache = $this->getCache();
            $key = $cache->getKey($aKey);
            $aResponse = $cache->get($key);
            if (null !== $aResponse) {
                return $this->processCategoryResponse($aResponse, $request);
            }

            $queryParameter = $request->query->all();
            if (0 === count($queryParameter)) {
                $queryParameter = null;
            }

            $aResponse = array(
                'activeShopArticle' => null,
                'activeShopCategory' => null,
                'redirectURL' => null,
                'redirectPermanent' => false,
                'noMatch' => false,
                'pagedef' => $pagedef,
                'queryParameter' => $queryParameter,
            );

            // does the URL match?
            $url = $oPathCat->GetLink(false);

            $catPrefix = $categoryPath;
            $tmp = array();
            if ('' !== $catPrefix) {
                $tmp[] = $catPrefix;
            }
            if ('' !== $category) {
                $tmp[] = $category;
            }
            $fullPath = '/'.implode('/', $tmp);

            if (false === $this->compareRelativeAndPrefixedURL($fullPath, $url)) {
                $aResponse['redirectURL'] = $oPathCat->GetLink(true);
                $aResponse['redirectPermanent'] = true;
                $key = null; // skip caching on redirect, otherwise we could lose URL parameters.
            }

            $aResponse['activeShopCategory'] = $oPathCat;
            if ('' !== $oPathCat->fieldDetailPageCmsTreeId) {
                $targetNode = TdbCmsTree::GetNewInstance($oPathCat->fieldDetailPageCmsTreeId);
                if (false !== $targetNode->sqlData) {
                    $pagedef = $targetNode->GetLinkedPage();
                    if (null !== $pagedef && false !== $pagedef) {
                        $aResponse['pagedef'] = $pagedef;
                    }
                }
            }
        } else {
            $aResponse['noMatch'] = true;
        }

        return $this->processCategoryResponse($aResponse, $request, $key);
    }
1300904
public function findCategory(CategoryInterface $searchCategory): ?CategoryInterface
    {
        foreach ($this->categories as $category) {
            if($category->getNumber() === $searchCategory->getNumber()) {
                return $category;
            }
        }

        return null;
    }
765068
public function sort(ModelInterface $category, array $data = []): PodiumResponse
    {
        $forumSorter = $this->getSorter();

        $forumSorter->setCategory($category);

        if (!$forumSorter->loadData($data)) {
            return PodiumResponse::error();
        }

        return $forumSorter->sort();
    }
847187
private function getStandardCategoriesQuery(array $categoryIds, $excludedCategories)
    {
        $conditionsParams  = ['data' => ['attribute' => 'category_ids', 'operator' => '()', 'value' => $categoryIds]];
        $categoryCondition = $this->productConditionsFactory->create($conditionsParams);

        return $this->queryBuilder->getSearchQuery($categoryCondition, $excludedCategories);
    }
1167546
public function index(CategoryRequest $request)
    {

        if ($this->response->typeIs('json')) {
            $pageLimit = $request->input('pageLimit');
            $data      = $this->repository
                ->setPresenter(\Litecms\Block\Repositories\Presenter\CategoryListPresenter::class)
                ->getDataTable($pageLimit);
            return $this->response
                ->data($data)
                ->output();
        }

        $categories = $this->repository->paginate();

        return $this->response->setMetaTitle(trans('block::category.names'))
            ->view('block::admin.category.index')
            ->data(compact('categories'))
            ->output();
    }
931559
public function getSearchQuery($excludedCategories = [])
    {
        $searchQuery = parent::getSearchQuery();

        if ($this->getAttribute() === 'category_ids') {
            $searchQuery = $this->getCategorySearchQuery($excludedCategories);
        }

        return $searchQuery;
    }
1228283
public function getAllFromCategories(array $categories)
    {
        $queryBuilder = $this->createQueryBuilder('p');
        $this->addPerformanceJoinsToQueryBuilder($queryBuilder);

        return $queryBuilder
            ->innerJoin('p.categories', 'c')
            ->where('c.id IN (:categories)')
            ->setParameters([
                'categories' => $categories,
            ])
            ->getQuery()
            ->getResult();
    }