[TASK] Make the site's identifier available in TypoScript 06/59506/2
authorGeorg Ringer <georg.ringer@gmail.com>
Mon, 21 Jan 2019 11:00:07 +0000 (12:00 +0100)
committerBenni Mack <benni@typo3.org>
Mon, 21 Jan 2019 13:05:08 +0000 (14:05 +0100)
Since #86422 the configuration of a site is available with TypoScript.
As the identifier itself is not part of the configuration, it can't be retrieved.

Now "site:identifier" will retrieve the identifier as well.

Resolves: #87434
Releases: master, 9.5
Change-Id: Ic5a60e8a033c8fbc45baa19ad6a3fe81ff3b6e0b
Reviewed-on: https://review.typo3.org/59506
Tested-by: TYPO3com <noreply@typo3.com>
Reviewed-by: Riny van Tiggelen <info@online-gamer.nl>
Tested-by: Riny van Tiggelen <info@online-gamer.nl>
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Josef Glatz <josef.glatz@typo3.org>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php

index 52004fd..2c82cc5 100644 (file)
@@ -4697,10 +4697,14 @@ class ContentObjectRenderer implements LoggerAwareInterface
                         $request = $GLOBALS['TYPO3_REQUEST'] ?? null;
                         $site = $request ? $request->getAttribute('site') : null;
                         if ($site instanceof Site) {
-                            try {
-                                $retVal = ArrayUtility::getValueByPath($site->getConfiguration(), $key, '.');
-                            } catch (MissingArrayPathException $exception) {
-                                $this->logger->warning(sprintf('getData() with "%s" failed', $key), ['exception' => $exception]);
+                            if ($key === 'identifier') {
+                                $retVal = $site->getIdentifier();
+                            } else {
+                                try {
+                                    $retVal = ArrayUtility::getValueByPath($site->getConfiguration(), $key, '.');
+                                } catch (MissingArrayPathException $exception) {
+                                    $this->logger->warning(sprintf('getData() with "%s" failed', $key), ['exception' => $exception]);
+                                }
                             }
                         }
                         break;