From f79ade8780fa4429e6bc8aa95cf39b0579296b43 Mon Sep 17 00:00:00 2001 From: Raphael Zschorsch Date: Fri, 13 Apr 2018 14:29:55 +0200 Subject: [PATCH] Allow defVals (i.e. header, header_layout, etc.) https://forge.typo3.org/issues/63379 --- Classes/Backend/LayoutSetup.php | 1 + Classes/Hooks/WizardItems.php | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Classes/Backend/LayoutSetup.php b/Classes/Backend/LayoutSetup.php index 4fda3e8..f82755e 100644 --- a/Classes/Backend/LayoutSetup.php +++ b/Classes/Backend/LayoutSetup.php @@ -600,6 +600,7 @@ public function getLayoutWizardItems( 'icon' => $item['icon'], 'iconIdentifier' => $item['iconIdentifier'], 'tll' => $item['top_level_layout'], + 'tt_content_defValues' => $item['tt_content_defValues.'], ]; } diff --git a/Classes/Hooks/WizardItems.php b/Classes/Hooks/WizardItems.php index 794eb19..3fa7bd8 100644 --- a/Classes/Hooks/WizardItems.php +++ b/Classes/Hooks/WizardItems.php @@ -276,12 +276,25 @@ public function addGridItemsToWizard(array &$gridItems, array &$wizardItems) ]); } } + + // Traverse defVals + $defVals = ''; + + if ($item['tt_content_defValues']) { + foreach ($item['tt_content_defValues'] as $field => $value) { + if ($field == 'header') { + $value = $GLOBALS['LANG']->sL($value); + } + $defVals .= '&defVals[tt_content][' . $field . ']=' . $value; + } + } + $itemIdentifier = $item['alias'] ? $item['alias'] : $item['uid']; $wizardItems['gridelements_' . $itemIdentifier] = [ 'title' => $item['title'], 'description' => $item['description'], 'params' => ($largeIcon ? '&largeIconImage=' . $largeIcon : '') - . '&defVals[tt_content][CType]=gridelements_pi1&defVals[tt_content][tx_gridelements_backend_layout]=' . $item['uid'] + . '&defVals[tt_content][CType]=gridelements_pi1' . $defVals . '&defVals[tt_content][tx_gridelements_backend_layout]=' . $item['uid'] . ($item['tll'] ? '&isTopLevelLayout' : ''), 'tt_content_defValues' => [ 'CType' => 'gridelements_pi1',