Skip to content

Commit

Permalink
Fix options page
Browse files Browse the repository at this point in the history
  • Loading branch information
PSMJonas committed Jun 17, 2024
1 parent ca67d22 commit 9605510
Showing 1 changed file with 4 additions and 16 deletions.
20 changes: 4 additions & 16 deletions src/OptionsPages.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,10 @@ static function __action_graphql_before_resolve_field(
/**
* If resolving field under options page root query set the current language
*/
if (self::is_options_page($source)) {
$root_query = $info->path[0];
$lang = self::$root_query_locale_mapping[$root_query] ?? null;
if ($lang) {
self::$current_language = $lang;
}
$root_query = $info->path[0];
$lang = self::$root_query_locale_mapping[$root_query] ?? null;
if ($lang) {
self::$current_language = $lang;
}
}

Expand Down Expand Up @@ -178,16 +176,6 @@ static function add_translation_suffix($id)
return $id . '_' . self::$current_language;
}

static function is_options_page($source)
{
if (!is_array($source)) {
return false;
}

$type = $source['type'] ?? null;
return $type === 'options_page';
}

static function is_options_page_root_query(ResolveInfo $info)
{
if (count($info->path) !== 1) {
Expand Down

0 comments on commit 9605510

Please sign in to comment.