getData('enableAnnouncements'); $numAnnouncementsHomepage = $contextOrSite->getData('numAnnouncementsHomepage'); if ($enableAnnouncements && $numAnnouncementsHomepage) { $collector = Repo::announcement() ->getCollector() ->filterByActive() ->limit((int) $numAnnouncementsHomepage); if (is_a($contextOrSite, Context::class)) { $collector->filterByContextIds([$contextOrSite->getId()]); } else { $collector->withSiteAnnouncements(Collector::SITE_ONLY); } $announcements = $collector->getMany(); $templateMgr->assign([ 'announcements' => $announcements->toArray(), 'numAnnouncementsHomepage' => $numAnnouncementsHomepage, ]); } } /** * Get the Highlights for this context */ protected function getHighlights(?Context $context = null): LazyCollection { if (!Config::getVar('features', 'highlights')) { return LazyCollection::make(); } $collector = Repo::highlight()->getCollector(); if ($context) { $collector->filterByContextIds([$context->getId()]); } else { $collector->withSiteHighlights($collector::SITE_ONLY); } return $collector->getMany(); } }