🐛 | Translate Drupal with GTranslate | TypeError: array_values(): Argument #1 ($array) must be of type array, null given in array_values()
🇬🇷Greece vagelis-prokopiou
This worked for me:
--- ./GTranslateBlock.php 2025-01-19 11:15:27.000725955 +0200
+++ html/modules/contrib/gtranslate/src/Plugin/Block/GTranslateBlock.php 2025-01-19 11:15:54.316640455 +0200
@@ -383,7 +383,7 @@
$url_structure = $settings->get('url_structure');
$custom_domains = $settings->get('custom_domains');
$custom_domains_config = $settings->get('custom_domains_config');
- $languages = array_values(array_filter(array_values($settings->get('languages')), function($l) {return !empty($l);}));
+ $languages = array_values(array_filter(array_values($settings->get('languages') ?? []), function($l) {return !empty($l);}));
$custom_css = $settings->get('custom_css');
$enable_cdn = $settings->get('enable_cdn');
@@ -440,4 +440,4 @@
return $return;
}
-}
\ No newline at end of file
+}
Module version: 3.0.4
PHP: 8.3
🇬🇷Greece vagelis-prokopiou
#10 💬 How to apply patches to a distribution via the composer workflow Fixed did the trick for me too. Thanks @colorfield.