[FEATURE] IRRE useCombination option to modify warning text 15/36415/8
authorAndreas Allacher <andreas.allacher@gmx.at>
Fri, 30 Jan 2015 12:30:58 +0000 (13:30 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Thu, 6 Aug 2015 12:28:40 +0000 (14:28 +0200)
Add support for inline elements in combination with
['appearance']['useCombination'] to suppress the warning
messages by using ['appearance']['suppressCombinationWarning']
or ['appearance']['overwriteCombinationWarningMessage'] to
overwrite the default message.
(allows LLL: values)

Change-Id: I0765b9316cdfa9e09eb6eaf4e366c9470bfb7d75
Resolves: #64535
Releases: master
Reviewed-on: http://review.typo3.org/36415
Reviewed-by: Daniel Goerz <ervaude@gmail.com>
Tested-by: Daniel Goerz <ervaude@gmail.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/backend/Classes/Form/Container/InlineRecordContainer.php
typo3/sysext/core/Documentation/Changelog/master/Feature-64535-IrreSuppressAndOverrideUseCombinationWarningViaTcaSettings.rst [new file with mode: 0644]

index fd90027..98a3d75 100644 (file)
@@ -253,13 +253,21 @@ class InlineRecordContainer extends AbstractContainer {
                                $comboRecord = $inlineRelatedRecordResolver->getNewRecord($this->globalOptions['inlineFirstPid'], $comboConfig['foreign_table']);
                                $isNewRecord = TRUE;
                        }
-                       $flashMessage = GeneralUtility::makeInstance(
-                               FlashMessage::class,
-                               $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:warning.inline_use_combination'),
-                               '',
-                               FlashMessage::WARNING
-                       );
-                       $resultArray['html'] = $flashMessage->render();
+
+                       // Display Warning FlashMessage if it is not suppressed
+                       if (!isset($config['appearance']['suppressCombinationWarning']) || empty($config['appearance']['suppressCombinationWarning']))
+                               $combinationWarningMessage = 'LLL:EXT:lang/locallang_core.xlf:warning.inline_use_combination';
+                               if (!empty($config['appearance']['overwriteCombinationWarningMessage'])) {
+                                       $combinationWarningMessage = $config['appearance']['overwriteCombinationWarningMessage'];
+                               }
+                               $flashMessage = GeneralUtility::makeInstance(
+                                       FlashMessage::class,
+                                       $this->getLanguageService()->sL($combinationWarningMessage),
+                                       '',
+                                       FlashMessage::WARNING
+                               );
+                               $resultArray['html'] = $flashMessage->render();
+                       }
 
                        // Get the FormEngine interpretation of the TCA of the child table
                        $childArray = $this->renderRecord($comboConfig['foreign_table'], $comboRecord);
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Feature-64535-IrreSuppressAndOverrideUseCombinationWarningViaTcaSettings.rst b/typo3/sysext/core/Documentation/Changelog/master/Feature-64535-IrreSuppressAndOverrideUseCombinationWarningViaTcaSettings.rst
new file mode 100644 (file)
index 0000000..b48cfe1
--- /dev/null
@@ -0,0 +1,42 @@
+================================================================================================
+Feature: #64535 - IRRE: Suppress and override useCombination warning via TCA settings
+================================================================================================
+
+Description
+===========
+
+When using ``useCombation=TRUE`` there is always a FlashMessage warning displayed.
+It is now possible to override the default warning message with a custom message or
+to suppress the FlashMessage completely via TCA setting.
+
+Example to suppress useCombination warning message:
+
+.. code-block:: php
+
+       $GLOBALS['TCA']['tx_demo_domain_model_demoinline']['columns']['irre_records']['config'] = array(
+               'foreign_types_combination' => array(
+                       '1' => array(
+                               'showitem' => 'title'
+                       )
+               )
+               'appearance' => array(
+                       'suppressCombinationWarning' => TRUE
+                       'useCombination' => TRUE
+               )
+       )
+
+Example to override useCombination warning message:
+
+.. code-block:: php
+
+       $GLOBALS['TCA']['tx_demo_domain_model_demoinline']['columns']['irre_records']['config'] = array(
+               'foreign_types_combination' => array(
+                       '1' => array(
+                               'showitem' => 'title'
+                       )
+               )
+               'appearance' => array(
+                       'overwriteCombinationWarningMessage' => 'LLL:EXT:demo/Resources/Private/Language/locallang_db.xlf:tx_demo_domain_model_demoinline.irre_records.useCombinationWarning'
+                       'useCombination' => TRUE
+               )
+       )