overrideTypes($result); return $this->overrideColumns($result); } /** * Override ['types'] configuration in child TCA * * @param array $result Main result array * @return array Modified result array */ protected function overrideTypes(array $result): array { if (!isset($result['inlineParentConfig']['overrideChildTca']['types'])) { return $result; } $result['processedTca']['types'] = array_replace_recursive( $result['processedTca']['types'], $result['inlineParentConfig']['overrideChildTca']['types'] ); return $result; } /** * Override ['columns'] configuration in child TCA. * Sanitizes that various hard dependencies can not be changed. * * @param array $result Main result array * @return array Modified result array * @throws \RuntimeException */ protected function overrideColumns(array $result): array { if (!isset($result['inlineParentConfig']['overrideChildTca']['columns'])) { return $result; } $fieldBlackList = $this->generateFieldBlackList($result); foreach ($fieldBlackList as $notChangeableFieldName) { if (isset($result['inlineParentConfig']['overrideChildTca']['columns'][$notChangeableFieldName])) { throw new \RuntimeException( 'System field \'' . $notChangeableFieldName . '\' can not be overridden in inline config' . ' \'overrideChildTca\' from parent TCA', 1490371322 ); } } $result['processedTca']['columns'] = array_replace_recursive( $result['processedTca']['columns'], $result['inlineParentConfig']['overrideChildTca']['columns'] ); return $result; } /** * Add field names defined in ctrl section of child table to black list * * @param array $result Main result array * @return array Column field names which can not be changed by parent TCA */ protected function generateFieldBlackList(array $result): array { $notSettableFields = $this->notSettableFields; foreach ($this->configurationKeysForNotSettableFields as $configurationKey) { if (isset($result['processedTca']['ctrl'][$configurationKey])) { $notSettableFields[] = $result['processedTca']['ctrl'][$configurationKey]; } } return $notSettableFields; } }