Skip to content

Commit

Permalink
Merge pull request #1 from webcoast-dk/bugfix/do-render-menues-if-empty
Browse files Browse the repository at this point in the history
[BUGFIX] Do not render menus, if settings are empty
  • Loading branch information
thommyhh authored Feb 2, 2024
2 parents 0c9204b + 83edd3f commit 6f8e73b
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 6f8e73b

Please sign in to comment.