Skip to content

Commit

Permalink
#21
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Barkowsky committed Feb 21, 2024
1 parent 89fc29a commit 26c40a7
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions src/EventListener/DataContainer/RegisterFieldsInPaletteListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,15 +142,7 @@ public function onLoadContentCallback(DataContainer $dataContainer): void

$options = [];

$addToModules = false;

if ('tl_module' === $table && (
InstalledVersions::isInstalled('contao/news-bundle') ||
InstalledVersions::isInstalled('contao/calendar-bundle') ||
InstalledVersions::isInstalled('contao/faq-bundle'))
) {
$addToModules = true;
}
$addToModulesDca = $this->checkAdditionsContaoModules($table);

$paletteManipulator = PaletteManipulator::create()
->addLegend('toolbox_legend', 'expert_legend', PaletteManipulator::POSITION_AFTER)
Expand Down Expand Up @@ -182,7 +174,7 @@ public function onLoadContentCallback(DataContainer $dataContainer): void
continue;
}

if (false === $addToModules) {
if (false === $addToModulesDca) {
continue;
}

Expand Down Expand Up @@ -225,4 +217,21 @@ public function checkPermission(string $table): bool

return true;
}

public function checkAdditionsContaoModules($table): bool
{
if ('tl_module' === $table) {
if (
(InstalledVersions::isInstalled('contao/news-bundle')) ||
(InstalledVersions::isInstalled('contao/calendar-bundle')) ||
(InstalledVersions::isInstalled('contao/faq-bundle'))
) {
return true;
} else {
return false;
}
}

return true;
}
}

0 comments on commit 26c40a7

Please sign in to comment.