public function entityLoaded(EntityLoadedEvent
$event): void
{ $salesChannelId =
$event instanceof SalesChannelEntityLoadedEvent ?
$event->
getSalesChannelContext()->
getSalesChannelId() : null;
/** @var CategoryEntity $category */
foreach ($event->
getEntities() as $category) { $categoryCmsPageId =
$category->
getCmsPageId();
// continue if cms page is given and was not set in the subscriber
if ($categoryCmsPageId !== null && !
$category->
getCmsPageIdSwitched()) { continue;
} // continue if cms page is given and not the overall default
if ($categoryCmsPageId !== null &&
$categoryCmsPageId !==
$this->systemConfigService->
get(CategoryDefinition::CONFIG_KEY_DEFAULT_CMS_PAGE_CATEGORY
)) { continue;
} $userDefault =
$this->systemConfigService->
get(CategoryDefinition::CONFIG_KEY_DEFAULT_CMS_PAGE_CATEGORY,
$salesChannelId);
// cms page is not given in system config