diff --git a/src/bundle/Controller/PageController.php b/src/bundle/Controller/PageController.php index 9461a712..1ed53d65 100644 --- a/src/bundle/Controller/PageController.php +++ b/src/bundle/Controller/PageController.php @@ -11,6 +11,7 @@ use eZ\Publish\API\Repository\ContentService; use eZ\Publish\API\Repository\ContentTypeService; use eZ\Publish\API\Repository\Exceptions\NotFoundException; +use eZ\Publish\API\Repository\Exceptions\UnauthorizedException; use eZ\Publish\API\Repository\LanguageService; use eZ\Publish\API\Repository\LocationService; use eZ\Publish\API\Repository\Values\Content\Content; @@ -253,7 +254,13 @@ public function locationViewAction( $versionInfo = $content->getVersionInfo(); $contentInfo = $content->contentInfo; - $creator = $this->contentService->loadContent($contentInfo->ownerId); + + try { + $creator = $this->contentService->loadContent($contentInfo->ownerId); + } catch (NotFoundException | UnauthorizedException $e) { + $creator = null; + } + $contentType = $this->contentTypeService->loadContentType($contentInfo->contentTypeId); $versionsDataset = $this->datasetFactory->versions(); $versionsDataset->load($contentInfo); @@ -652,7 +659,11 @@ public function editAction(ContentEditView $view): ContentEditView $siteaccesses = $this->pageBuilderConfigurationResolver->getSiteaccessList(); $currentSiteaccess = $this->session->get(EzPlatformPageBuilderExtension::SESSION_KEY_SITEACCESS, reset($siteaccesses)); - $creator = $this->contentService->loadContent($content->contentInfo->ownerId); + try { + $creator = $this->contentService->loadContent($content->contentInfo->ownerId); + } catch (NotFoundException | UnauthorizedException $e) { + $creator = null; + } $pageFieldIdentifier = $this->getPageFieldIdentifier($contentType); /** @var Value $pageFieldValue */ diff --git a/src/bundle/Resources/translations/ezplatform_page_builder_infobar.en.xlf b/src/bundle/Resources/translations/ezplatform_page_builder_infobar.en.xlf index 81837ed6..6a6a2bcf 100644 --- a/src/bundle/Resources/translations/ezplatform_page_builder_infobar.en.xlf +++ b/src/bundle/Resources/translations/ezplatform_page_builder_infobar.en.xlf @@ -16,6 +16,11 @@ Switch to the Field view and fill in the required fields key: infobar.error.message + + Can’t fetch author + Can’t fetch author + key: infobar.author.not_found + Not all blocks were properly configured. Please, update missing data. Switch to the Field view and fill in the other required fields Not all blocks were properly configured. Please, update missing data. Switch to the Field view and fill in the other required fields diff --git a/src/bundle/Resources/views/page_builder/infobar/base.html.twig b/src/bundle/Resources/views/page_builder/infobar/base.html.twig index 8879e1bf..88a2d80a 100644 --- a/src/bundle/Resources/views/page_builder/infobar/base.html.twig +++ b/src/bundle/Resources/views/page_builder/infobar/base.html.twig @@ -79,7 +79,11 @@ {% block details %}
- {{ 'infobar.author.name'|trans({'%name%': creator.name})|desc('by %name%')|raw }}
+ {% if creator is not empty %} + {{ 'infobar.author.name'|trans({'%name%': creator.name})|desc('by %name%')|raw }}
+ {% else %} + {{ 'infobar.author.not_found'|trans|desc('Can’t fetch author') }}
+ {% endif %} {{ 'infobar.last_edited'|trans|desc('Last edited:') }} {{ content.versionInfo.modificationDate|localizeddate }}