Skip to content

Commit

Permalink
Fix language in treepicker
Browse files Browse the repository at this point in the history
  • Loading branch information
zonky2 committed Jan 6, 2025
1 parent 99ae61b commit b5d450f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Contao/View/Contao2BackendView/TreePicker.php
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ public function setLanguageInProvider(DataProviderInterface $dataDriver, mixed $
$currentLanguage = ($session['ml_support'][$providerName] ?? $GLOBALS['TL_LANGUAGE']);
$languages = $controller->getSupportedLanguages($rootId);

if (!\array_key_exists($currentLanguage, $languages)) {
if ([] !== $languages && !\array_key_exists($currentLanguage, $languages)) {
$fallbackLanguage = $dataDriver->getFallbackLanguage($rootId);
assert($fallbackLanguage instanceof LanguageInformationInterface);

Expand Down Expand Up @@ -608,7 +608,7 @@ public function renderItemsPlain()
$config->setSorting([$this->orderField => 'ASC']);
}

$this->setLanguageInProvider($dataDriver, $value);
$this->setLanguageInProvider($dataDriver, \array_shift($value));
foreach ($dataDriver->fetchAll($config) as $model) {
if (!($model instanceof ModelInterface)) {
continue;
Expand Down

0 comments on commit b5d450f

Please sign in to comment.