Skip to content

Instantly share code, notes, and snippets.

@kitzberger
Last active October 26, 2020 14:30
Show Gist options
  • Save kitzberger/a8304be3acf8994e84d1b7960e46c2a2 to your computer and use it in GitHub Desktop.
Save kitzberger/a8304be3acf8994e84d1b7960e46c2a2 to your computer and use it in GitHub Desktop.
TYPO3 PageTs Hack for gridelement backend layouts
--- a/typo3/sysext/backend/Classes/Form/FormDataProvider/PageTsConfigMerged.php 2020-10-26 14:41:48.000000000 +0100
+++ b/typo3/sysext/backend/Classes/Form/FormDataProvider/PageTsConfigMerged.php 2020-10-26 14:56:45.000000000 +0100
@@ -53,6 +53,21 @@
if (!empty($typeSpecificConfiguration[$type . '.']) && is_array($typeSpecificConfiguration[$type . '.'])) {
ArrayUtility::mergeRecursiveWithOverrule($newFieldConfiguration, $typeSpecificConfiguration[$type . '.']);
}
+ // hack for gridelements begins
+ if ($type === 'gridelements_pi1') {
+ if (!empty($fullFieldConfiguration['types.']['gridelements_pi1.']) &&
+ is_array($fullFieldConfiguration['types.']['gridelements_pi1.']) &&
+ !empty($fullFieldConfiguration['types.']['gridelements_pi1.']['types.']) &&
+ is_array($fullFieldConfiguration['types.']['gridelements_pi1.']['types.']))
+ {
+ $subtype = $result['databaseRow']['tx_gridelements_backend_layout'];
+ $subtypeSpecificConfiguration = $fullFieldConfiguration['types.']['gridelements_pi1.']['types.'];
+ if (!empty($subtypeSpecificConfiguration[$subtype . '.']) && is_array($subtypeSpecificConfiguration[$subtype . '.'])) {
+ ArrayUtility::mergeRecursiveWithOverrule($newFieldConfiguration, $subtypeSpecificConfiguration[$subtype . '.']);
+ }
+ }
+ }
+ // hack for gridelements ends
}
$mergedTsConfig['TCEFORM.'][$table . '.'][$fieldNameWithDot] = $newFieldConfiguration;
}
@kitzberger
Copy link
Author

This allows to provide PageTs overrides per grid type:

TCEFORM {
	tt_content {
		# New field label
		header.types.gridelements_pi1.label = Gridelement Header
		# And it's different for tx_gridelements_backend_layout=3
		header.types.gridelements_pi1.types.3.label = Gridelement Header (grid layout = 3)

		# No pi_flexform for CType=gridelements_pi1
		pi_flexform.types.gridelements_pi1.disabled = 1
		# But for tx_gridelements_backend_layout=3 show it!
		pi_flexform.types.gridelements_pi1.types.3.disabled = 0
	}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment