Skip to content

Commit

Permalink
Merge branch 'hotfix/fix_be_nav' into 'release/2.3.0'
Browse files Browse the repository at this point in the history
Fix BE navigation error

See merge request metamodels/core!297
  • Loading branch information
zonky2 committed Jul 10, 2024
2 parents 959bfab + b036152 commit 3fd6c4a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ protected function buildFilterParamsFor(DC_Table $dataContainer, $elementName)
*/
public function saveCallback(string $value = null)
{
return '--null--' === $value ? null : base64_decode($value);
return ('--null--' === $value || null === $value) ? null : base64_decode($value);
}

/**
Expand Down
6 changes: 5 additions & 1 deletion src/CoreBundle/EventListener/BackendNavigationListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@

use function array_key_exists;
use function array_map;
use function array_unshift;
use function in_array;
use function is_array;

Expand Down Expand Up @@ -150,8 +151,11 @@ public function __invoke(MenuEvent $event): void

// Show MetaModels config only for Admins.
if ($isAdmin) {
// Add or override child - might have been introduced by parsing of legacy BE_MOD.
$metaModelsNode->addChild($configNode = $this->buildConfigNode($factory, $request));
array_unshift($names, $configNode->getName());
if (!in_array($configNode->getName(), $names, true)) {
array_unshift($names, $configNode->getName());
}
}

$metaModelsNode->reorderChildren($names);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function __invoke(CreateMetaModelEvent $event): void
{
$metaModel = $event->getMetaModel();
$language = $GLOBALS['TL_LANGUAGE'] ?? null;
if ($language && $metaModel instanceof ITranslatedMetaModel) {
if (null !== $language && $metaModel instanceof ITranslatedMetaModel) {
$metaModel->selectLanguage($language);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ private function fetchDomains(): iterable
function (): iterable {
$result = [];

$installedLanguages = $this->localeProvider->getEnabledLocaleIds();
$installedLanguages = \array_values($this->localeProvider->getEnabledLocaleIds());
foreach ($this->factory->collectNames() as $metamodelName) {
$instance = $this->factory->getMetaModel($metamodelName);
if (!$instance instanceof ITranslatedMetaModel) {
Expand Down

0 comments on commit 3fd6c4a

Please sign in to comment.