$newDefaultCmsPageId =
$event->
getValue();
$systemConfigKey =
$event->
getKey();
$salesChannelId =
$event->
getSalesChannelId();
if (!\
in_array($systemConfigKey, self::
$defaultCmsPageConfigKeys, true
)) { return;
} // prevent deleting the overall default (salesChannelId === null)
// a sales channel specific default can still be deleted (salesChannelId !== null)
if ($newDefaultCmsPageId === null &&
$salesChannelId === null
) { $oldCmsPageId =
$this->
getCurrentOverallDefaultCmsPageId($systemConfigKey);
throw CmsException::
overallDefaultSystemConfigDeletion($oldCmsPageId);
} if (!\
is_string($newDefaultCmsPageId) &&
$newDefaultCmsPageId !== null
) { throw new PageNotFoundException('invalid page'
);
} // prevent changing the default to an invalid cms page id
if (\
is_string($newDefaultCmsPageId) && !
$this->
cmsPageExists($newDefaultCmsPageId)) { throw new PageNotFoundException($newDefaultCmsPageId);
}