File tree 2 files changed +35
-0
lines changed
2 files changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -151,6 +151,34 @@ class ProcessGraphQL extends Process implements Module {
151
151
return json_encode($response);
152
152
}
153
153
154
+ /**
155
+ * The hook for modifying the GraphQL query operation by the user.
156
+ * The query operation could be modified with addField/addFields methods.
157
+ * See the documentation of the library used by this module to learn more
158
+ * @see The GraphQL lib https://github.com/Youshido/GraphQL
159
+ * @param $query The $query object that will be modified.
160
+ * @return The $query object to modify. Do not replace the returned value,
161
+ * but modify it with addField/addFields methods
162
+ */
163
+ public function ___getQuery($query)
164
+ {
165
+ return $query;
166
+ }
167
+
168
+ /**
169
+ * The hook for modifying the GraphQL mutation operation by the user.
170
+ * The mutation operation could be modified with addField/addFields methods.
171
+ * See the documentation of the library used by this module to learn more
172
+ * @see The GraphQL lib https://github.com/Youshido/GraphQL
173
+ * @param * $mutation The $mutation object that will be modified.
174
+ * @return * The $mutation object to modify. The same thing as the
175
+ * $query argument.
176
+ */
177
+ public function ___getMutation($mutation)
178
+ {
179
+ return $mutation;
180
+ }
181
+
154
182
/**
155
183
* Install the module page under setup
156
184
*/
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ public function build(SchemaConfig $config)
26
26
*/
27
27
$ query = $ config ->getQuery ();
28
28
29
+
29
30
// $pages API
30
31
if ($ moduleConfig ->pagesQuery ) {
31
32
$ query ->addField (new PagesField ());
@@ -60,6 +61,9 @@ public function build(SchemaConfig $config)
60
61
$ query ->addField (new LanguageField ());
61
62
}
62
63
64
+ // let the user modify the query operation
65
+ Utils::module ()->getQuery ($ query );
66
+
63
67
/**
64
68
* Mutation
65
69
*/
@@ -75,6 +79,9 @@ public function build(SchemaConfig $config)
75
79
$ mutation ->addField (new UpdateTemplatedPage ($ template ));
76
80
}
77
81
82
+ // let the user modify the mutation operation
83
+ Utils::module ()->getMutation ($ mutation );
84
+
78
85
}
79
86
80
87
public function getName ()
You can’t perform that action at this time.
0 commit comments