[TASK] Add more information to IRRE titles 85/58385/8
authorFrank Naegler <frank.naegler@typo3.org>
Tue, 25 Sep 2018 09:16:57 +0000 (11:16 +0200)
committerGeorg Ringer <georg.ringer@gmail.com>
Wed, 26 Sep 2018 11:17:17 +0000 (13:17 +0200)
This patch put more information into IRRE titles of site configuration.

Resolves: #85887
Releases: master
Change-Id: I7d3df7b9513eb9cd591605eb450c4ae451b1fd75
Reviewed-on: https://review.typo3.org/58385
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Jörg Bösche <typo3@joergboesche.de>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
typo3/sysext/backend/Classes/Configuration/TCA/UserFunctions.php [new file with mode: 0644]
typo3/sysext/backend/Configuration/SiteConfiguration/site.php
typo3/sysext/backend/Configuration/SiteConfiguration/site_errorhandling.php
typo3/sysext/backend/Configuration/SiteConfiguration/site_language.php
typo3/sysext/backend/Configuration/SiteConfiguration/site_route.php
typo3/sysext/backend/Resources/Private/Language/locallang_siteconfiguration_tca.xlf
typo3/sysext/core/Resources/Private/Language/locallang_common.xlf

diff --git a/typo3/sysext/backend/Classes/Configuration/TCA/UserFunctions.php b/typo3/sysext/backend/Classes/Configuration/TCA/UserFunctions.php
new file mode 100644 (file)
index 0000000..c2f9ff2
--- /dev/null
@@ -0,0 +1,78 @@
+<?php
+declare(strict_types = 1);
+namespace TYPO3\CMS\Backend\Configuration\TCA;
+
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+use TYPO3\CMS\Core\Localization\LanguageService;
+
+/**
+ * This class provides user functions for the usage in TCA definition
+ * @internal
+ */
+class UserFunctions
+{
+    public function getSiteLanguageTitle(array &$parameters): void
+    {
+        $record = $parameters['row'];
+        $parameters['title'] = sprintf(
+            '%s %s (%s) Base: %s',
+            $record['enabled'] ? '' : '[' . $this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_common.xlf:disabled') . ']',
+            $record['title'],
+            $record['locale'],
+            $record['base']
+        );
+    }
+
+    public function getRouteTitle(array &$parameters): void
+    {
+        $record = $parameters['row'];
+        if ($record['type'][0] === 'uri') {
+            $parameters['title'] = sprintf(
+                '%s %s %s',
+                $record['route'],
+                $this->getLanguageService()->sL('LLL:EXT:backend/Resources/Private/Language/locallang_siteconfiguration_tca.xlf:site.routes.irreHeader.redirectsTo'),
+                $record['source'] ?: '[' . $this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_common.xlf:undefined') . ']'
+            );
+        } else {
+            $parameters['title'] = $record['route'];
+        }
+    }
+
+    public function getErrorHandlingTitle(array &$parameters): void
+    {
+        $record = $parameters['row'];
+        $format = '%s: %s';
+        $arguments = [$record['errorCode']];
+        switch ($record['errorHandler'][0]) {
+            case 'Fluid':
+                $arguments[] = $record['errorFluidTemplate'];
+                break;
+            case 'Page':
+                $arguments[] = $record['errorContentSource'];
+                break;
+            case 'PHP':
+                $arguments[] = $record['errorPhpClassFQCN'];
+                break;
+            default:
+                $arguments[] = $record['errorHandler'][0];
+        }
+        $parameters['title'] = sprintf($format, ...$arguments);
+    }
+
+    protected function getLanguageService(): LanguageService
+    {
+        return $GLOBALS['LANG'];
+    }
+}
index 3c19215..3a5f510 100644 (file)
@@ -61,6 +61,7 @@ return [
                 'size' => 4,
                 'minitems' => 1,
                 'appearance' => [
+                    'collapseAll' => true,
                     'enabledControls' => [
                         'info' => false,
                     ],
@@ -73,6 +74,7 @@ return [
                 'type' => 'inline',
                 'foreign_table' => 'site_errorhandling',
                 'appearance' => [
+                    'collapseAll' => true,
                     'enabledControls' => [
                         'info' => false,
                     ],
@@ -85,6 +87,7 @@ return [
                 'type' => 'inline',
                 'foreign_table' => 'site_route',
                 'appearance' => [
+                    'collapseAll' => true,
                     'enabledControls' => [
                         'info' => false,
                     ],
index 3b6ad24..1c0925c 100644 (file)
@@ -3,8 +3,7 @@
 return [
     'ctrl' => [
         'label' => 'errorHandler',
-        'label_alt' => 'errorCode',
-        'label_alt_force' => true,
+        'label_userFunc' => \TYPO3\CMS\Backend\Configuration\TCA\UserFunctions::class . '->getErrorHandlingTitle',
         'title' => 'LLL:EXT:backend/Resources/Private/Language/locallang_siteconfiguration_tca.xlf:site_errorhandling.ctrl.title',
         'type' => 'errorHandler',
         'typeicon_column' => 'errorHandler',
index 248399e..f91d032 100644 (file)
@@ -3,6 +3,7 @@
 return [
     'ctrl' => [
         'label' => 'languageId',
+        'label_userFunc' => \TYPO3\CMS\Backend\Configuration\TCA\UserFunctions::class . '->getSiteLanguageTitle',
         'title' => 'LLL:EXT:backend/Resources/Private/Language/locallang_siteconfiguration_tca.xlf:site_language.ctrl.title',
         'typeicon_classes' => [
             'default' => 'mimetypes-x-content-domain',
index da2cf0b..16e472c 100644 (file)
@@ -3,6 +3,7 @@
 return [
     'ctrl' => [
         'label' => 'route',
+        'label_userFunc' => \TYPO3\CMS\Backend\Configuration\TCA\UserFunctions::class . '->getRouteTitle',
         'title' => 'LLL:EXT:backend/Resources/Private/Language/locallang_siteconfiguration_tca.xlf:site_route.ctrl.title',
         'type' => 'type',
         'typeicon_column' => 'type',
index 911b7e1..647c1b2 100644 (file)
@@ -27,6 +27,9 @@
                        <trans-unit id="site.routes">
                                <source>Routes</source>
                        </trans-unit>
+                       <trans-unit id="site.routes.irreHeader.redirectsTo">
+                               <source>redirects to</source>
+                       </trans-unit>
                        <trans-unit id="site.tab.languages">
                                <source>Languages</source>
                        </trans-unit>
index c370562..0110df2 100644 (file)
                        <trans-unit id="tsRef">
                                <source>TSref reference</source>
                        </trans-unit>
+                       <trans-unit id="undefined">
+                               <source>Undefined</source>
+                       </trans-unit>
                        <trans-unit id="up">
                                <source>Up</source>
                        </trans-unit>