[TASK] Further improvements for the site configuration 99/58399/4
authorJosef Glatz <josefglatz@gmail.com>
Wed, 26 Sep 2018 14:01:43 +0000 (16:01 +0200)
committerFrank Naegler <frank.naegler@typo3.org>
Thu, 27 Sep 2018 12:51:36 +0000 (14:51 +0200)
This patch enhances the self declaration of the site
configuration form elements.

- TCA descriptions were added to specific elements to
  provide a better clarity on how to use them.
- First char uppercase on existing descriptions.
- Input fields gets properly trimmed now.
- Additional placeholders were added.

Beside that, all missing PHPDoc blocks are added to
the previously added UserFunctions class.

Releases: master
Resolves: #86387
Related: #85887
Change-Id: I684bb2044e4bb7ce3a6c60bf4656e83260fedafe
Reviewed-on: https://review.typo3.org/58399
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Guido Schmechel <guido.schmechel@brandung.de>
Tested-by: Guido Schmechel <guido.schmechel@brandung.de>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Frank Naegler <frank.naegler@typo3.org>
Tested-by: Frank Naegler <frank.naegler@typo3.org>
typo3/sysext/backend/Classes/Configuration/TCA/UserFunctions.php
typo3/sysext/backend/Configuration/SiteConfiguration/site.php
typo3/sysext/backend/Configuration/SiteConfiguration/site_base_variant.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/backend/Resources/Private/Language/siteconfiguration_fieldinformation.xlf

index c2f9ff2..c14b56d 100644 (file)
@@ -23,6 +23,11 @@ use TYPO3\CMS\Core\Localization\LanguageService;
  */
 class UserFunctions
 {
+    /**
+     * Used to build the IRRE title of a site language element
+     *
+     * @param array $parameters
+     */
     public function getSiteLanguageTitle(array &$parameters): void
     {
         $record = $parameters['row'];
@@ -35,6 +40,11 @@ class UserFunctions
         );
     }
 
+    /**
+     * Used to build the IRRE title of a site route element
+     *
+     * @param array $parameters
+     */
     public function getRouteTitle(array &$parameters): void
     {
         $record = $parameters['row'];
@@ -50,6 +60,10 @@ class UserFunctions
         }
     }
 
+    /**
+     * Used to build the IRRE title of a site error handling element
+     * @param array $parameters
+     */
     public function getErrorHandlingTitle(array &$parameters): void
     {
         $record = $parameters['row'];
@@ -71,6 +85,9 @@ class UserFunctions
         $parameters['title'] = sprintf($format, ...$arguments);
     }
 
+    /**
+     * @return LanguageService
+     */
     protected function getLanguageService(): LanguageService
     {
         return $GLOBALS['LANG'];
index 3a5f510..67aecc3 100644 (file)
@@ -18,7 +18,7 @@ return [
                 'max' => 255,
                 // identifier is used as directory name - allow a-z,0-9,_,- as chars only.
                 // unique is additionally checked server side
-                'eval' => 'required,lower,alphanum_x',
+                'eval' => 'required, lower, alphanum_x, trim',
             ],
         ],
         'rootPageId' => [
@@ -36,11 +36,12 @@ return [
             'description' => 'LLL:EXT:backend/Resources/Private/Language/siteconfiguration_fieldinformation.xlf:site.base',
             'config' => [
                 'type' => 'input',
-                'eval' => 'required',
+                'eval' => 'required, trim',
             ],
         ],
         'baseVariants' => [
             'label' => 'LLL:EXT:backend/Resources/Private/Language/locallang_siteconfiguration_tca.xlf:site.baseVariants',
+            'description' => 'LLL:EXT:backend/Resources/Private/Language/siteconfiguration_fieldinformation.xlf:site.baseVariants',
             'config' => [
                 'type' => 'inline',
                 'foreign_table' => 'site_base_variant',
index 477f0e3..69316c6 100644 (file)
@@ -13,22 +13,26 @@ return [
     'columns' => [
         'base' => [
             'label' => 'LLL:EXT:backend/Resources/Private/Language/locallang_siteconfiguration_tca.xlf:site_base_variant.base',
+            'description' => 'LLL:EXT:backend/Resources/Private/Language/siteconfiguration_fieldinformation.xlf:site_base_variant.base',
             'config' => [
                 'type' => 'input',
-                'eval' => 'required',
+                'eval' => 'required, trim',
+                'placeholder' => 'LLL:EXT:backend/Resources/Private/Language/locallang_siteconfiguration_tca.xlf:site_base_variant.base.placeholder',
             ],
         ],
         'condition' => [
             'label' => 'LLL:EXT:backend/Resources/Private/Language/locallang_siteconfiguration_tca.xlf:site_base_variant.condition',
+            'description' => 'LLL:EXT:backend/Resources/Private/Language/siteconfiguration_fieldinformation.xlf:site_base_variant.condition',
             'config' => [
                 'type' => 'input',
-                'eval' => 'required',
+                'eval' => 'required, trim',
                 'valuePicker' => [
                     'items' => [
                         [ 'LLL:EXT:backend/Resources/Private/Language/locallang_siteconfiguration_tca.xlf:site_base_variant.condition.applicationContext', 'applicationContext == "Production"'],
                         [ 'LLL:EXT:backend/Resources/Private/Language/locallang_siteconfiguration_tca.xlf:site_base_variant.condition.environmentVariable', 'getenv("mycontext") == "production"'],
                     ],
                 ],
+                'placeholder' => 'LLL:EXT:backend/Resources/Private/Language/locallang_siteconfiguration_tca.xlf:site_base_variant.condition.placeholder',
             ],
         ],
     ],
index 1c0925c..ae0f0f7 100644 (file)
@@ -57,25 +57,29 @@ return [
             'description' => 'LLL:EXT:backend/Resources/Private/Language/siteconfiguration_fieldinformation.xlf:site_errorhandling.errorFluidTemplate',
             'config' => [
                 'type' => 'input',
-                'eval' => 'required',
+                'eval' => 'required, trim',
+                'placeholder' => 'LLL:EXT:backend/Resources/Private/Language/locallang_siteconfiguration_tca.xlf:site_errorhandling.errorFluidTemplate.placeholder',
             ],
         ],
         'errorFluidTemplatesRootPath' => [
             'label' => 'LLL:EXT:backend/Resources/Private/Language/locallang_siteconfiguration_tca.xlf:site_errorhandling.errorFluidTemplatesRootPath',
             'config' => [
                 'type' => 'input',
+                'eval' => 'trim',
             ],
         ],
         'errorFluidLayoutsRootPath' => [
             'label' => 'LLL:EXT:backend/Resources/Private/Language/locallang_siteconfiguration_tca.xlf:site_errorhandling.errorFluidLayoutsRootPath',
             'config' => [
                 'type' => 'input',
+                'eval' => 'trim',
             ],
         ],
         'errorFluidPartialsRootPath' => [
             'label' => 'LLL:EXT:backend/Resources/Private/Language/locallang_siteconfiguration_tca.xlf:site_errorhandling.errorFluidPartialsRootPath',
             'config' => [
                 'type' => 'input',
+                'eval' => 'trim',
             ],
         ],
         'errorContentSource' => [
@@ -98,7 +102,8 @@ return [
             'description' => 'LLL:EXT:backend/Resources/Private/Language/siteconfiguration_fieldinformation.xlf:site_errorhandling.errorPhpClassFQCN',
             'config' => [
                 'type' => 'input',
-                'eval' => 'required',
+                'eval' => 'required, trim',
+                'placeholder' => 'LLL:EXT:backend/Resources/Private/Language/locallang_siteconfiguration_tca.xlf:site_errorhandling.errorPhpClassFQCN.placeholder',
             ],
         ],
     ],
index f91d032..05b51e2 100644 (file)
@@ -29,7 +29,7 @@ return [
             'config' => [
                 'type' => 'input',
                 'size' => 10,
-                'eval' => 'required',
+                'eval' => 'required, trim',
                 'placeholder' => 'English',
             ],
         ],
@@ -38,6 +38,7 @@ return [
             'config' => [
                 'type' => 'input',
                 'size' => 10,
+                'eval' => 'trim',
                 'placeholder' => 'English',
             ],
         ],
@@ -46,8 +47,9 @@ return [
             'description' => 'LLL:EXT:backend/Resources/Private/Language/siteconfiguration_fieldinformation.xlf:site_language.base',
             'config' => [
                 'type' => 'input',
-                'eval' => 'required',
+                'eval' => 'required, trim',
                 'default' => '/',
+                'placeholder' => '/',
             ],
         ],
         'locale' => [
@@ -55,7 +57,7 @@ return [
             'description' => 'LLL:EXT:backend/Resources/Private/Language/siteconfiguration_fieldinformation.xlf:site_language.locale',
             'config' => [
                 'type' => 'input',
-                'eval' => 'required',
+                'eval' => 'required, trim',
                 'placeholder' => 'en_US.UTF-8',
             ],
         ],
@@ -72,6 +74,7 @@ return [
             'label' => 'LLL:EXT:backend/Resources/Private/Language/locallang_siteconfiguration_tca.xlf:site_language.hreflang',
             'config' => [
                 'type' => 'input',
+                'eval' => 'trim',
                 'placeholder' => 'en-US',
             ],
         ],
index 16e472c..4dfdd28 100644 (file)
@@ -17,7 +17,13 @@ return [
             'label' => 'LLL:EXT:backend/Resources/Private/Language/locallang_siteconfiguration_tca.xlf:site_route.route',
             'config' => [
                 'type' => 'input',
-                'eval' => 'required',
+                'eval' => 'required, trim',
+                'placeholder' => 'LLL:EXT:backend/Resources/Private/Language/locallang_siteconfiguration_tca.xlf:site_route.route.placeholder',
+                'valuePicker' => [
+                    'items' => [
+                        ['LLL:EXT:backend/Resources/Private/Language/locallang_siteconfiguration_tca.xlf:site_route.route.example1', 'robots.txt'],
+                    ],
+                ],
             ],
         ],
         'type' => [
@@ -38,6 +44,15 @@ return [
             'config' => [
                 'type' => 'text',
                 'eval' => 'required',
+                'valuePicker' => [
+                    'items' => [
+                        ['LLL:EXT:backend/Resources/Private/Language/locallang_siteconfiguration_tca.xlf:site_route.staticText.example1', 'User-agent: *
+Disallow: /typo3/
+Disallow: /typo3_src/
+Allow: /typo3/sysext/frontend/Resources/Public/*
+'],
+                    ],
+                ],
             ],
         ],
         'source' => [
index 647c1b2..b4c4355 100644 (file)
                        <trans-unit id="site_base_variant.base">
                                <source>Base</source>
                        </trans-unit>
+                       <trans-unit id="site_base_variant.base.placeholder">
+                               <source>www.domain.local</source>
+                       </trans-unit>
                        <trans-unit id="site_base_variant.condition">
                                <source>Condition</source>
                        </trans-unit>
+                       <trans-unit id="site_base_variant.condition.placeholder">
+                               <source>applicationContext == "Production"</source>
+                       </trans-unit>
                        <trans-unit id="site_base_variant.condition.applicationContext">
                                <source>Application Context</source>
                        </trans-unit>
                        <trans-unit id="site_errorhandling.errorFluidTemplate">
                                <source>Fluid Template File</source>
                        </trans-unit>
+                       <trans-unit id="site_errorhandling.errorFluidTemplate.placeholder">
+                               <source>EXT:my_sitepackage/Resources/Private/Templates/Sites/Error.html</source>
+                       </trans-unit>
                        <trans-unit id="site_errorhandling.errorFluidTemplatesRootPath">
                                <source>Fluid Templates Root Path</source>
                        </trans-unit>
                        <trans-unit id="site_errorhandling.errorPhpClassFQCN">
                                <source>ErrorHandler Class Target (FQCN)</source>
                        </trans-unit>
+                       <trans-unit id="site_errorhandling.errorPhpClassFQCN.placeholder">
+                               <source>Vendor\ExtensionName\ErrorHandlers\GenericErrorhandler</source>
+                       </trans-unit>
                        <trans-unit id="site_route.ctrl.title">
                                <source>Routes</source>
                        </trans-unit>
                        <trans-unit id="site_route.staticText">
                                <source>Static Text</source>
                        </trans-unit>
+                       <trans-unit id="site_route.staticText.example1">
+                               <source>robots.txt Example Content</source>
+                       </trans-unit>
                        <trans-unit id="site_route.source">
                                <source>Page, File or URL</source>
                        </trans-unit>
                        <trans-unit id="site_route.route">
                                <source>Static Route Name</source>
                        </trans-unit>
+                       <trans-unit id="site_route.route.placeholder">
+                               <source>my-custom_route</source>
+                       </trans-unit>
+                       <trans-unit id="site_route.route.example1">
+                               <source>robots.txt</source>
+                       </trans-unit>
                </body>
        </file>
 </xliff>
index 19bc4f5..d7bbc2a 100644 (file)
@@ -9,23 +9,32 @@
                        <trans-unit id="site.base">
                                <source>Main URL to call the frontend in default language.</source>
                        </trans-unit>
+                       <trans-unit id="site.baseVariants">
+                               <source>This allows you to specify variants of the site's base. Can be used, for example, if you have a different domain for your staging environment.</source>
+                       </trans-unit>
                        <trans-unit id="site_language.base">
-                               <source>use / to use keep the main URL as configured at field Entry Point. Add language specific suffixes to use those, or configure complete URLs for independent domains.</source>
+                               <source>Use / To use keep the main URL as configured at field Entry Point. Add language specific suffixes to use those, or configure complete URLs for independent domains.</source>
                        </trans-unit>
                        <trans-unit id="site_language.locale">
-                               <source>should be something like de_DE or en_US.UTF-8</source>
+                               <source>Should be something like de_DE or en_US.UTF-8</source>
                        </trans-unit>
                        <trans-unit id="site_language.typo3Language">
                                <source>Select the language to be used from translation files. Keep default if no translation files are available.</source>
                        </trans-unit>
                        <trans-unit id="site_errorhandling.errorCode">
-                               <source>make sure to have at least 0 (not defined otherwise) configured in order to serve helpful error messages to your visitors.</source>
+                               <source>Make sure to have at least 0 (not defined otherwise) configured in order to serve helpful error messages to your visitors.</source>
                        </trans-unit>
                        <trans-unit id="site_errorhandling.errorFluidTemplate">
-                               <source>absolute or relative path (from site root) to fluid template file</source>
+                               <source>Path to the fluid template file given by absolute, relative path (from site root) or by referring the template file inside an extension with "EXT:" prefix.</source>
                        </trans-unit>
                        <trans-unit id="site_errorhandling.errorPhpClassFQCN">
-                               <source>PHP class full qualified name that serves the error page.</source>
+                               <source>Fully qualified class name to a class that implements the PageErrorHandlerInterface.</source>
+                       </trans-unit>
+                       <trans-unit id="site_base_variant.base">
+                               <source>For example staging.domain.tld or www.domain.local</source>
+                       </trans-unit>
+                       <trans-unit id="site_base_variant.condition">
+                               <source>Expression to match this base variant.</source>
                        </trans-unit>
                </body>
        </file>