wp-graphql-polylang icon indicating copy to clipboard operation
wp-graphql-polylang copied to clipboard

Fix options page

Open PSMJonas opened this issue 1 year ago • 2 comments

The output of the content based on the selected language did not work because the type attribute was not present:

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

$type is always null.

PSMJonas avatar Jun 17 '24 08:06 PSMJonas

This DOES fix the issue! Nice call.- Beware in the commit, you've removed is_options_page but it is still called line 150

geck1942 avatar Jul 19 '24 12:07 geck1942

The resolver is executed on all queries, maybe we could keep the function is_options_page and compare the class of the 'node' attribute ?

Something like :

$type = $source['type'] ?? null;
$class_name = isset($source['node']) ? get_class($source['node']) : null;
return $type === 'options_page' || $class_name == \WPGraphQL\Acf\Model\AcfOptionsPage::class;

Aku-benj avatar Sep 23 '24 16:09 Aku-benj

I've just checked the snippet above, it seems to work indeed. However, I am not familiar enough with the plugin to implement this and understand the consequences. Can someone with more experience verify this and merge this so the issue can be solved?

jponsen avatar Jan 08 '25 08:01 jponsen

Can this fix be implemented please? So we can stop using a mirror plugin with just this fix :)

sjaakbanaan avatar May 14 '25 14:05 sjaakbanaan