- Issue created by @oakulm
- Status changed to Needs review
7 months ago 12:25pm 9 April 2024 - last update
7 months ago 1 pass
When you have a page that does not have translation, an exception is thrown.
The website encountered an unexpected error. Try again later.
TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in in_array() (line 153 of modules/contrib/lang_dropdown/src/Form/LanguageDropdownForm.php).
if (!$this->settings['showall'] && in_array('locale-untranslated', $lang_options['attributes']['class'], TRUE)) {
continue;
}
to
if (!$this->settings['showall'] && !empty($lang_options['attributes']['class']) && in_array('locale-untranslated', $lang_options['attributes']['class'], TRUE)) {
continue;
}
// Identify if session negotiation had set session-active class.
if (in_array('session-active', $lang_options['attributes']['class'], TRUE)) {
$language_session_selected = $lang_code;
}
to
// Identify if session negotiation had set session-active class.
if (!empty($lang_options['attributes']['class']) && in_array('session-active', $lang_options['attributes']['class'], TRUE)) {
$language_session_selected = $lang_code;
}
Needs review
2.1
Code