From dfba03d5679dd3e031fc576bb1ffd620073ab103 Mon Sep 17 00:00:00 2001 From: Ingolf Steinardt Date: Thu, 11 Jul 2024 08:30:31 +0200 Subject: [PATCH] Fix editAll link an other small fixes --- .../DcGeneral/DefinitionBuilder/CommandBuilder.php | 9 +++++---- src/Helper/LocaleUtil.php | 11 +---------- src/TranslatedMetaModel.php | 2 +- 3 files changed, 7 insertions(+), 15 deletions(-) diff --git a/src/CoreBundle/EventListener/DcGeneral/DefinitionBuilder/CommandBuilder.php b/src/CoreBundle/EventListener/DcGeneral/DefinitionBuilder/CommandBuilder.php index 8dbf8db1d..628736d88 100644 --- a/src/CoreBundle/EventListener/DcGeneral/DefinitionBuilder/CommandBuilder.php +++ b/src/CoreBundle/EventListener/DcGeneral/DefinitionBuilder/CommandBuilder.php @@ -183,10 +183,11 @@ private function addEditMultipleCommand(Contao2BackendViewDefinitionInterface $v ->setLabel('editAll.label') ->setDescription('editAll.description'); - $parameters = $command->getParameters(); - $parameters['act'] = 'select'; - $extra = $command->getExtra(); - $extra['class'] = 'header_edit_all'; + $parameters = $command->getParameters(); + $parameters['act'] = 'select'; + $parameters['select'] = 'models'; + $extra = $command->getExtra(); + $extra['class'] = 'header_edit_all'; $commands->addCommand($command); } diff --git a/src/Helper/LocaleUtil.php b/src/Helper/LocaleUtil.php index e602d2b5e..99e0f8302 100644 --- a/src/Helper/LocaleUtil.php +++ b/src/Helper/LocaleUtil.php @@ -36,16 +36,7 @@ final class LocaleUtil */ public static function formatAsLanguageTag(string $localeId): string { - $packages = System::getContainer()->getParameter('kernel.packages'); - assert(is_array($packages)); - $coreVersion = $packages['contao/core-bundle'] ?? ''; - - if (\version_compare($coreVersion, '4.13', '>=')) { - return self::formatAsLocale($localeId); - } - - // Legacy call. - return \str_replace('_', '-', ContaoLocaleUtil::formatAsLocale($localeId)); + return self::formatAsLocale($localeId); } /** diff --git a/src/TranslatedMetaModel.php b/src/TranslatedMetaModel.php index be072a7d5..b83d5aa54 100644 --- a/src/TranslatedMetaModel.php +++ b/src/TranslatedMetaModel.php @@ -136,7 +136,7 @@ public function selectLanguage(string $activeLanguage): string protected function fetchTranslatedAttributeValues(ITranslated $attribute, $ids) { // @deprecated usage of TL_LANGUAGE - remove for Contao 5.0. - $originalLanguage = LocaleUtil::formatAsLocale($GLOBALS['TL_LANGUAGE']); + $originalLanguage = LocaleUtil::formatAsLocale($GLOBALS['TL_LANGUAGE'] ?? 'en'); $GLOBALS['TL_LANGUAGE'] = LocaleUtil::formatAsLanguageTag($this->getLanguage()); try {