Skip to content

Commit

Permalink
Improved page palette in latest Contao versions
Browse files Browse the repository at this point in the history
  • Loading branch information
aschempp committed Jan 4, 2022
1 parent adb1381 commit bb47788
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/EventListener/DataContainer/PageInitializationListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,15 @@ private function handleEditAllMode(): void

private function addRootLanguageFields(): void
{
PaletteManipulator::create()
->addField('languageRoot', 'fallback')
$hasLegacyRouting = isset($GLOBALS['TL_DCA']['tl_page']['fields']['disableLanguageRedirect']);

$pm = PaletteManipulator::create()
->addField('languageRoot', $hasLegacyRouting ? 'language' : 'fallback')
->applyToPalette('root', 'tl_page')
;

if (isset($GLOBALS['TL_DCA']['tl_page']['palettes']['rootfallback'])) {
PaletteManipulator::create()
->addField('languageRoot', 'fallback')
->applyToPalette('rootfallback', 'tl_page')
;
$pm->applyToPalette('rootfallback', 'tl_page');
}
}

Expand Down

0 comments on commit bb47788

Please sign in to comment.