- Issue created by @Ruuds
- 🇨🇦Canada SKAUGHT
@ruuds
how many 'extra' languages did you disable in the project? can you outline this a bit more? - 🇳🇱Netherlands Ruuds
Initially, the project had three active languages (Dutch, Flemish and French). Two of these were removed (Flemish and French), but the dropdown language was left in place because another new language will be added instead soon.
The $links variable is only set when
if (count($languages) > 1)
so when the module is used when only one language is present,count($links)
will always result in this warning. - 🇩🇪Germany Anybody Porta Westfalica
@SKAUGHT: See https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Language%...
and https://www.drupal.org/node/3247792 →
This explains the issue. So the proposed fix is NOT correct. I'll provide a MR. This should be fixed with a new stable release ASAP.
- @anybody opened merge request.
- 🇩🇪Germany Anybody Porta Westfalica
Please have a look at the links in#4 and my MR. I first thought about providing a
[]
fallback value but presumably it doesn't make any sense to proceed if there are no links?Otherwise, replace the return statement by
$links = [];
and a clear comment that the core method returns NULL but we need an array here. - 🇩🇪Germany Anybody Porta Westfalica
The alternative approach can be found here: 🐛 Incorporate Drupal 9.4 core changes to getLanguageSwitchLinks Fixed .
One of them is a duplicate. Pick the one you like more @SKAUGHT! :) - Status changed to Closed: duplicate
almost 2 years ago 2:07pm 16 March 2023 - 🇩🇪Germany Anybody Porta Westfalica
Has been fixed in 🐛 Incorporate Drupal 9.4 core changes to getLanguageSwitchLinks Fixed !