Skip to content

Commit 33878d7

Browse files
authored
Update PolylangTypes.php
1 parent a81c861 commit 33878d7

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/PolylangTypes.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ function __action_graphql_register_types()
1919
$language_codes = [];
2020

2121
foreach (pll_languages_list() as $lang) {
22-
$language_codes[strtoupper($lang)] = $lang;
22+
// Fix: Always use the same format for values
23+
$language_codes[strtoupper($lang)] = [
24+
'value' => $lang,
25+
];
2326
}
2427

2528
if (empty($language_codes)) {
@@ -47,11 +50,16 @@ function __action_graphql_register_types()
4750
'wp-graphql-polylang'
4851
),
4952
'values' => array_merge($language_codes, [
50-
'DEFAULT' => 'default',
51-
'ALL' => 'all',
53+
'DEFAULT' => [
54+
'value' => 'default'
55+
],
56+
'ALL' => [
57+
'value' => 'all'
58+
],
5259
]),
5360
]);
5461

62+
// Rest of the code remains the same
5563
register_graphql_object_type('Language', [
5664
'description' => __('Language (Polylang)', 'wp-graphql-polylang'),
5765
'fields' => [

0 commit comments

Comments
 (0)