[BUGFIX] FormEngine inline foreign_selector and foreign_unique
[Packages/TYPO3.CMS.git] / typo3 / sysext / backend / Classes / Form / FormDataProvider / InlineOverrideChildTca.php
index 029f4f5..93639ca 100644 (file)
@@ -15,6 +15,7 @@ namespace TYPO3\CMS\Backend\Form\FormDataProvider;
  */
 
 use TYPO3\CMS\Backend\Form\FormDataProviderInterface;
+use TYPO3\CMS\Core\Utility\ArrayUtility;
 
 /**
  * Override some child TCA in an inline parent child relation.
@@ -37,6 +38,20 @@ class InlineOverrideChildTca implements FormDataProviderInterface
             }
         }
 
+        // Override config section of foreign_selector field pointer if given
+        if (isset($result['inlineParentConfig']['foreign_selector'])
+            && is_string($result['inlineParentConfig']['foreign_selector'])
+            && isset($result['inlineParentConfig']['foreign_selector_fieldTcaOverride'])
+            && is_array($result['inlineParentConfig']['foreign_selector_fieldTcaOverride'])
+            && isset($result['processedTca']['columns'][$result['inlineParentConfig']['foreign_selector']])
+            && is_array($result['processedTca']['columns'][$result['inlineParentConfig']['foreign_selector']])
+        ) {
+            ArrayUtility::mergeRecursiveWithOverrule(
+                $result['processedTca']['columns'][$result['inlineParentConfig']['foreign_selector']],
+                $result['inlineParentConfig']['foreign_selector_fieldTcaOverride']
+            );
+        }
+
         // Set default values for (new) child if foreign_record_defaults is defined in inlineParentConfig
         if (isset($result['inlineParentConfig']['foreign_record_defaults']) && is_array($result['inlineParentConfig']['foreign_record_defaults'])) {
             $foreignTableConfig = $GLOBALS['TCA'][$result['inlineParentConfig']['foreign_table']];
@@ -70,7 +85,7 @@ class InlineOverrideChildTca implements FormDataProviderInterface
                 }
             }
             foreach ($result['inlineParentConfig']['foreign_record_defaults'] as $fieldName => $defaultValue) {
-                if (isset($foreignTableConfig['columns'][$fieldName]) && !in_array($fieldName, $notSetableFields, TRUE)) {
+                if (isset($foreignTableConfig['columns'][$fieldName]) && !in_array($fieldName, $notSetableFields, true)) {
                     $result['processedTca']['columns'][$fieldName]['config']['default'] = $defaultValue;
                 }
             }