Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions components/SEOBundle/bundle/Core/MetaNameSchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
use Ibexa\Core\Repository\Values\Content\VersionInfo;
use Ibexa\FieldTypeRichText\FieldType\RichText\Value as RichTextValue;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
use Psr\Log\LoggerInterface;
use Psr\Log\NullLogger;

class MetaNameSchema extends NameSchemaService
{
Expand Down Expand Up @@ -83,6 +85,7 @@ public function __construct(
RepositoryInterface $repository,
TranslationHelper $translationHelper,
ConfigResolverInterface $configurationResolver,
?LoggerInterface $logger = null,
array $settings = []
) {
$this->fieldTypeRegistry = $fieldTypeRegistry;
Expand All @@ -99,6 +102,7 @@ public function __construct(
$this->translationHelper = $translationHelper;
$this->relationListField = $this->fieldTypeRegistry->getFieldType('ezobjectrelationlist');
$this->configurationResolver = $configurationResolver;
$this->logger = $logger ?? new NullLogger();
}

public function setRichTextConverter(RichTextConverterInterface $richTextConverter): void
Expand Down Expand Up @@ -266,8 +270,16 @@ protected function handleRelationValue(RelationValue $value, string $languageCod
if (!$value->destinationContentId) {
return '';
}
$relatedContent = $this->repository->getContentService()->loadContent($value->destinationContentId);
// @todo: we can probably be better here and handle more than just "image"
//if the content is not translated
try {
$relatedContent = $this->repository->getContentService()->loadContent($value->destinationContentId);
} catch (\Exception $e) {
$this->logger->error($e->getMessage(), [
'exception' => $e,
]);
return '';
}
// @todo: we can probably be better here and handle more than just "image"
$fieldImageValue = $relatedContent->getFieldValue('image');
if ($fieldImageValue instanceof ImageValue) {
if ($fieldImageValue->uri) {
Expand Down
Loading