diff --git a/src/LanguageRootQueries.php b/src/LanguageRootQueries.php index fd4b1ef..309a4f1 100644 --- a/src/LanguageRootQueries.php +++ b/src/LanguageRootQueries.php @@ -55,6 +55,16 @@ function __action_graphql_register_types() } } + if (isset($fields['active'])) { + foreach ( + pll_languages_list(['fields' => 'active']) + as $index => $active + ) { + $languages[$index]['active'] = + $active === false ? false : true; + } + } + if (isset($fields['homeUrl'])) { foreach ($languages as &$language) { $language['homeUrl'] = pll_home_url($language['slug']); diff --git a/src/PolylangTypes.php b/src/PolylangTypes.php index 0b9b1ab..8070856 100644 --- a/src/PolylangTypes.php +++ b/src/PolylangTypes.php @@ -92,6 +92,10 @@ function __action_graphql_register_types() 'wp-graphql-polylang' ), ], + 'active' => [ + 'type' => 'Boolean', + 'description' => __('Is language active.'), + ], 'homeUrl' => [ 'type' => 'String', 'description' => __(