From 8c139fbe04b7803f9014391e7951967b8dff2835 Mon Sep 17 00:00:00 2001 From: Marcel Diegelmann Date: Wed, 5 Nov 2025 14:37:38 +0100 Subject: [PATCH] =?UTF-8?q?Erm=C3=B6gliche=20R=C3=BCckgabe=20aller=20m?= =?UTF-8?q?=C3=B6glichen=20Sprachoptionen=20in=20Verbindung=20mit=20den=20?= =?UTF-8?q?vom=20Nutzer=20freigeschalteten.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Form/Type/DataSourceSynonymRowType.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/Form/Type/DataSourceSynonymRowType.php b/src/Form/Type/DataSourceSynonymRowType.php index eeed32cd..58970ce7 100644 --- a/src/Form/Type/DataSourceSynonymRowType.php +++ b/src/Form/Type/DataSourceSynonymRowType.php @@ -60,7 +60,7 @@ class DataSourceSynonymRowType extends AbstractType 'required' => true, // Restrict to languages configured in the language menu: disable ChoiceLoader and provide explicit choices 'choice_loader' => null, - 'choices' => $this->buildLocaleChoices(), + 'choices' => $this->buildLocaleChoices(true), 'preferred_choices' => $this->getPreferredLocales(), 'constraints' => [ new Assert\NotBlank(message: 'settings.system.data_source_synonyms.row_type.value_not_blank'), @@ -97,9 +97,14 @@ class DataSourceSynonymRowType extends AbstractType * Returns only locales configured in the language menu (settings) or falls back to the parameter. * Format: ['German (DE)' => 'de', ...] */ - private function buildLocaleChoices(): array + private function buildLocaleChoices(bool $returnPossible = false): array { $locales = $this->getPreferredLocales(); + + if ($returnPossible) { + $locales = $this->getPossibleLocales(); + } + $choices = []; foreach ($locales as $code) { $label = Locales::getName($code); @@ -119,6 +124,11 @@ class DataSourceSynonymRowType extends AbstractType return !empty($fromSettings) ? array_values($fromSettings) : array_values($this->preferredLanguagesParam); } + private function getPossibleLocales(): array + { + return array_values($this->preferredLanguagesParam); + } + public function configureOptions(OptionsResolver $resolver): void { $resolver->setRequired('data_sources');