File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change 33namespace ProcessWire \GraphQL \Type \InterfaceType ;
44
55use Youshido \GraphQL \Type \InterfaceType \AbstractInterfaceType ;
6+ use ProcessWire \Field ;
67use ProcessWire \GraphQL \Type \Object \TemplatedPageType ;
8+ use ProcessWire \GraphQL \Settings ;
79
810class PageType extends AbstractInterfaceType {
911
@@ -45,6 +47,16 @@ public function build($config)
4547 $ className = "ProcessWire \\GraphQL \\Field \\Page \\$ pageTypeFieldClassName " ;
4648 $ config ->addField (new $ className ());
4749 }
50+
51+ // add global fields too
52+ $ legalFields = Settings::getLegalFields ();
53+ foreach ($ legalFields as $ field ) {
54+ if ($ field ->flags & Field::flagGlobal) {
55+ $ className = "\\ProcessWire \\GraphQL \\Field \\Page \\Fieldtype \\" . $ field ->type ->className ();
56+ if (!class_exists ($ className )) continue ;
57+ $ config ->addField (new $ className ($ field ));
58+ }
59+ }
4860 }
4961
5062 public function resolveType ($ page )
You can’t perform that action at this time.
0 commit comments