Skip to content

Commit

Permalink
[BUGFIX] Do not render menus, if settings are empty
Browse files Browse the repository at this point in the history
Check if there are pages selected in the respective menu field before running the data actual processing
to avoid menu pages determined from empty settings.
  • Loading branch information
thommyhh committed Feb 2, 2024
1 parent 0c9204b commit 83edd3f
Showing 1 changed file with 27 additions and 9 deletions.
36 changes: 27 additions & 9 deletions ext_localconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,31 @@

$menuIndex = 100;
foreach ($menuConfiguration->getActiveMenus() as $menu => $configuration) {
$typoScriptSetup .= sprintf(
<<<EOTS
page.20.dataProcessing.{$menuIndex} = %s
page.20.dataProcessing.{$menuIndex} {
as = menu%s
levels = %s
$typoScriptSetup .= sprintf('
page.20.dataProcessing.%1$d = %2$s
page.20.dataProcessing.%1$d {
as = menu%3$s
levels = %4$s
if.isTrue.cObject = CONTENT
if.isTrue.cObject {
table = pages
select {
pidInList.data = leveluid:0
recursive = 10
join = tx_editablemenus_menu_pages_mm m ON m.uid_foreign=pages.uid
where {
data = leveluid:0
wrap = {#m.field_name} = "%5$s_menu" AND {#m.uid_local}=|
}
orderBy = m.sorting asc
}
renderObj = TEXT
renderObj {
field = uid
wrap = |,
}
stdWrap.substring = 0,-1
}
special = list
special.value.cObject = CONTENT
special.value.cObject {
Expand All @@ -26,7 +45,7 @@
join = tx_editablemenus_menu_pages_mm m ON m.uid_foreign=pages.uid
where {
data = leveluid:0
wrap = {#m.field_name} = "%s_menu" AND {#m.uid_local}=|
wrap = {#m.field_name} = "%5$s_menu" AND {#m.uid_local}=|
}
orderBy = m.sorting asc
}
Expand All @@ -38,8 +57,7 @@
stdWrap.substring = 0,-1
}
}
EOTS, \TYPO3\CMS\Frontend\DataProcessing\MenuProcessor::class, \TYPO3\CMS\Core\Utility\GeneralUtility::underscoredToUpperCamelCase($menu), $configuration['levels'] ?? 1, $menu
', $menuIndex, \TYPO3\CMS\Frontend\DataProcessing\MenuProcessor::class, \TYPO3\CMS\Core\Utility\GeneralUtility::underscoredToUpperCamelCase($menu), $configuration['levels'] ?? 1, $menu
);

++$menuIndex;
Expand Down

0 comments on commit 83edd3f

Please sign in to comment.