From 2ac94ed95f1e7cdc8b83bc60a94311d469dc3eca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20S=C5=82omka?= Date: Thu, 14 Sep 2023 09:20:50 +0200 Subject: [PATCH] Update src/lib/Repository/EventSubscriber/NameSchemaSubscriber.php Co-authored-by: Andrew Longosz --- .../EventSubscriber/NameSchemaSubscriber.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/lib/Repository/EventSubscriber/NameSchemaSubscriber.php b/src/lib/Repository/EventSubscriber/NameSchemaSubscriber.php index 12c7fc8ef9..55e0293e18 100644 --- a/src/lib/Repository/EventSubscriber/NameSchemaSubscriber.php +++ b/src/lib/Repository/EventSubscriber/NameSchemaSubscriber.php @@ -167,18 +167,17 @@ private function getValues( continue; } - $field = $fieldMap ? $fieldMap[$identifier][$languageCode] ?? '' : $content->getFieldValue( - $identifier, - $languageCode - ); + if (!empty($fieldMap)) { + $fieldValue = $fieldMap[$identifier][$languageCode] ?? null; + } else { + $fieldValue = $content !== null ? $content->getFieldValue($identifier, $languageCode) : null; + } - $field = $field ? $persistenceFieldType->getName( - $field, + $tokenValues[$identifier] = $fieldValue !== null ? $persistenceFieldType->getName( + $fieldValue, $fieldDefinition, $languageCode ) : ''; - - $tokenValues[$identifier] = $field; } return $tokenValues;