@@ -23,243 +23,243 @@ |
||
23 | 23 | class Ticket extends TypeBase |
24 | 24 | { |
25 | 25 | |
26 | - /** |
|
27 | - * Ticket constructor. |
|
28 | - * |
|
29 | - * @param EEM_Ticket $ticket_model |
|
30 | - */ |
|
31 | - public function __construct(EEM_Ticket $ticket_model) |
|
32 | - { |
|
33 | - $this->model = $ticket_model; |
|
34 | - $this->setName('Ticket'); |
|
35 | - $this->setDescription(__('A ticket for an event date', 'event_espresso')); |
|
36 | - $this->setIsCustomPostType(false); |
|
37 | - parent::__construct(); |
|
38 | - } |
|
26 | + /** |
|
27 | + * Ticket constructor. |
|
28 | + * |
|
29 | + * @param EEM_Ticket $ticket_model |
|
30 | + */ |
|
31 | + public function __construct(EEM_Ticket $ticket_model) |
|
32 | + { |
|
33 | + $this->model = $ticket_model; |
|
34 | + $this->setName('Ticket'); |
|
35 | + $this->setDescription(__('A ticket for an event date', 'event_espresso')); |
|
36 | + $this->setIsCustomPostType(false); |
|
37 | + parent::__construct(); |
|
38 | + } |
|
39 | 39 | |
40 | 40 | |
41 | - /** |
|
42 | - * @return GraphQLFieldInterface[] |
|
43 | - * @since $VID:$ |
|
44 | - */ |
|
45 | - protected function getFields() |
|
46 | - { |
|
47 | - return [ |
|
48 | - new GraphQLField( |
|
49 | - 'id', |
|
50 | - ['non_null' => 'Int'], |
|
51 | - 'ID', |
|
52 | - esc_html__('Ticket ID', 'event_espresso') |
|
53 | - ), |
|
54 | - new GraphQLField( |
|
55 | - 'name', |
|
56 | - 'String', |
|
57 | - 'name', |
|
58 | - esc_html__('Ticket Name', 'event_espresso') |
|
59 | - ), |
|
60 | - new GraphQLField( |
|
61 | - 'description', |
|
62 | - 'String', |
|
63 | - 'description', |
|
64 | - esc_html__('Description of Ticket', 'event_espresso') |
|
65 | - ), |
|
66 | - new GraphQLField( |
|
67 | - 'startDate', |
|
68 | - 'String', |
|
69 | - 'start_date', |
|
70 | - esc_html__('Start time/date of Ticket', 'event_espresso') |
|
71 | - ), |
|
72 | - new GraphQLField( |
|
73 | - 'endDate', |
|
74 | - 'String', |
|
75 | - 'end_date', |
|
76 | - esc_html__('End time/date of Ticket', 'event_espresso') |
|
77 | - ), |
|
78 | - new GraphQLField( |
|
79 | - 'min', |
|
80 | - 'Int', |
|
81 | - 'min', |
|
82 | - esc_html__('Minimum quantity of this ticket that must be purchased', 'event_espresso') |
|
83 | - ), |
|
84 | - new GraphQLField( |
|
85 | - 'max', |
|
86 | - 'Int', |
|
87 | - 'max', |
|
88 | - esc_html__('Maximum quantity of this ticket that can be purchased in one transaction', 'event_espresso'), |
|
89 | - [$this, 'parseInfiniteValue'] |
|
90 | - ), |
|
91 | - new GraphQLField( |
|
92 | - 'price', |
|
93 | - 'Float', |
|
94 | - 'price', |
|
95 | - esc_html__('Final calculated price for ticket', 'event_espresso') |
|
96 | - ), |
|
97 | - new GraphQLField( |
|
98 | - 'sold', |
|
99 | - 'Int', |
|
100 | - 'sold', |
|
101 | - esc_html__('Number of this ticket sold', 'event_espresso') |
|
102 | - ), |
|
103 | - new GraphQLField( |
|
104 | - 'quantity', |
|
105 | - 'Int', |
|
106 | - 'qty', |
|
107 | - esc_html__('Quantity of this ticket that is available', 'event_espresso'), |
|
108 | - [$this, 'parseInfiniteValue'] |
|
109 | - ), |
|
110 | - new GraphQLField( |
|
111 | - 'reserved', |
|
112 | - 'Int', |
|
113 | - 'reserved', |
|
114 | - esc_html__('Quantity of this ticket that is reserved, but not yet fully purchased', 'event_espresso') |
|
115 | - ), |
|
116 | - new GraphQLField( |
|
117 | - 'uses', |
|
118 | - 'Int', |
|
119 | - 'uses', |
|
120 | - esc_html__('Number of datetimes this ticket can be used at', 'event_espresso'), |
|
121 | - [$this, 'parseInfiniteValue'] |
|
122 | - ), |
|
123 | - new GraphQLField( |
|
124 | - 'isRequired', |
|
125 | - 'Boolean', |
|
126 | - 'required', |
|
127 | - esc_html__('Flag indicating whether this ticket must be purchased with a transaction', 'event_espresso') |
|
128 | - ), |
|
129 | - new GraphQLField( |
|
130 | - 'isTaxable', |
|
131 | - 'Boolean', |
|
132 | - 'taxable', |
|
133 | - esc_html__('Flag indicating whether there is tax applied on this ticket', 'event_espresso') |
|
134 | - ), |
|
135 | - new GraphQLField( |
|
136 | - 'isDefault', |
|
137 | - 'Boolean', |
|
138 | - 'is_default', |
|
139 | - esc_html__('Flag indicating that this ticket is a default ticket', 'event_espresso') |
|
140 | - ), |
|
141 | - new GraphQLField( |
|
142 | - 'order', |
|
143 | - 'Int', |
|
144 | - 'order', |
|
145 | - esc_html__('The order in which the Datetime is displayed', 'event_espresso') |
|
146 | - ), |
|
147 | - new GraphQLField( |
|
148 | - 'row', |
|
149 | - 'Int', |
|
150 | - 'row', |
|
151 | - esc_html__('How tickets are displayed in the ui', 'event_espresso') |
|
152 | - ), |
|
153 | - new GraphQLOutputField( |
|
154 | - 'wpUser', |
|
155 | - 'User', |
|
156 | - null, |
|
157 | - esc_html__('Ticket Creator', 'event_espresso') |
|
158 | - ), |
|
159 | - new GraphQLInputField( |
|
160 | - 'wpUser', |
|
161 | - 'Int', |
|
162 | - null, |
|
163 | - esc_html__('Ticket Creator ID', 'event_espresso') |
|
164 | - ), |
|
165 | - new GraphQLOutputField( |
|
166 | - 'parent', |
|
167 | - 'Ticket', |
|
168 | - null, |
|
169 | - esc_html__('The parent ticket of the current ticket', 'event_espresso') |
|
170 | - ), |
|
171 | - new GraphQLInputField( |
|
172 | - 'parent', |
|
173 | - 'Int', |
|
174 | - null, |
|
175 | - esc_html__('The parent ticket ID', 'event_espresso') |
|
176 | - ), |
|
177 | - new GraphQLField( |
|
178 | - 'reverseCalculate', |
|
179 | - 'Boolean', |
|
180 | - 'reverse_calculate', |
|
181 | - esc_html__('Flag indicating whether ticket calculations should run in reverse and calculate the base ticket price from the provided ticket total.', 'event_espresso') |
|
182 | - ), |
|
183 | - new GraphQLField( |
|
184 | - 'isFree', |
|
185 | - 'Boolean', |
|
186 | - 'is_free', |
|
187 | - esc_html__('Flag indicating whether the ticket is free.', 'event_espresso') |
|
188 | - ), |
|
189 | - new GraphQLOutputField( |
|
190 | - 'event', |
|
191 | - 'Event', |
|
192 | - null, |
|
193 | - esc_html__('Event of the ticket.', 'event_espresso') |
|
194 | - ), |
|
195 | - ]; |
|
196 | - } |
|
41 | + /** |
|
42 | + * @return GraphQLFieldInterface[] |
|
43 | + * @since $VID:$ |
|
44 | + */ |
|
45 | + protected function getFields() |
|
46 | + { |
|
47 | + return [ |
|
48 | + new GraphQLField( |
|
49 | + 'id', |
|
50 | + ['non_null' => 'Int'], |
|
51 | + 'ID', |
|
52 | + esc_html__('Ticket ID', 'event_espresso') |
|
53 | + ), |
|
54 | + new GraphQLField( |
|
55 | + 'name', |
|
56 | + 'String', |
|
57 | + 'name', |
|
58 | + esc_html__('Ticket Name', 'event_espresso') |
|
59 | + ), |
|
60 | + new GraphQLField( |
|
61 | + 'description', |
|
62 | + 'String', |
|
63 | + 'description', |
|
64 | + esc_html__('Description of Ticket', 'event_espresso') |
|
65 | + ), |
|
66 | + new GraphQLField( |
|
67 | + 'startDate', |
|
68 | + 'String', |
|
69 | + 'start_date', |
|
70 | + esc_html__('Start time/date of Ticket', 'event_espresso') |
|
71 | + ), |
|
72 | + new GraphQLField( |
|
73 | + 'endDate', |
|
74 | + 'String', |
|
75 | + 'end_date', |
|
76 | + esc_html__('End time/date of Ticket', 'event_espresso') |
|
77 | + ), |
|
78 | + new GraphQLField( |
|
79 | + 'min', |
|
80 | + 'Int', |
|
81 | + 'min', |
|
82 | + esc_html__('Minimum quantity of this ticket that must be purchased', 'event_espresso') |
|
83 | + ), |
|
84 | + new GraphQLField( |
|
85 | + 'max', |
|
86 | + 'Int', |
|
87 | + 'max', |
|
88 | + esc_html__('Maximum quantity of this ticket that can be purchased in one transaction', 'event_espresso'), |
|
89 | + [$this, 'parseInfiniteValue'] |
|
90 | + ), |
|
91 | + new GraphQLField( |
|
92 | + 'price', |
|
93 | + 'Float', |
|
94 | + 'price', |
|
95 | + esc_html__('Final calculated price for ticket', 'event_espresso') |
|
96 | + ), |
|
97 | + new GraphQLField( |
|
98 | + 'sold', |
|
99 | + 'Int', |
|
100 | + 'sold', |
|
101 | + esc_html__('Number of this ticket sold', 'event_espresso') |
|
102 | + ), |
|
103 | + new GraphQLField( |
|
104 | + 'quantity', |
|
105 | + 'Int', |
|
106 | + 'qty', |
|
107 | + esc_html__('Quantity of this ticket that is available', 'event_espresso'), |
|
108 | + [$this, 'parseInfiniteValue'] |
|
109 | + ), |
|
110 | + new GraphQLField( |
|
111 | + 'reserved', |
|
112 | + 'Int', |
|
113 | + 'reserved', |
|
114 | + esc_html__('Quantity of this ticket that is reserved, but not yet fully purchased', 'event_espresso') |
|
115 | + ), |
|
116 | + new GraphQLField( |
|
117 | + 'uses', |
|
118 | + 'Int', |
|
119 | + 'uses', |
|
120 | + esc_html__('Number of datetimes this ticket can be used at', 'event_espresso'), |
|
121 | + [$this, 'parseInfiniteValue'] |
|
122 | + ), |
|
123 | + new GraphQLField( |
|
124 | + 'isRequired', |
|
125 | + 'Boolean', |
|
126 | + 'required', |
|
127 | + esc_html__('Flag indicating whether this ticket must be purchased with a transaction', 'event_espresso') |
|
128 | + ), |
|
129 | + new GraphQLField( |
|
130 | + 'isTaxable', |
|
131 | + 'Boolean', |
|
132 | + 'taxable', |
|
133 | + esc_html__('Flag indicating whether there is tax applied on this ticket', 'event_espresso') |
|
134 | + ), |
|
135 | + new GraphQLField( |
|
136 | + 'isDefault', |
|
137 | + 'Boolean', |
|
138 | + 'is_default', |
|
139 | + esc_html__('Flag indicating that this ticket is a default ticket', 'event_espresso') |
|
140 | + ), |
|
141 | + new GraphQLField( |
|
142 | + 'order', |
|
143 | + 'Int', |
|
144 | + 'order', |
|
145 | + esc_html__('The order in which the Datetime is displayed', 'event_espresso') |
|
146 | + ), |
|
147 | + new GraphQLField( |
|
148 | + 'row', |
|
149 | + 'Int', |
|
150 | + 'row', |
|
151 | + esc_html__('How tickets are displayed in the ui', 'event_espresso') |
|
152 | + ), |
|
153 | + new GraphQLOutputField( |
|
154 | + 'wpUser', |
|
155 | + 'User', |
|
156 | + null, |
|
157 | + esc_html__('Ticket Creator', 'event_espresso') |
|
158 | + ), |
|
159 | + new GraphQLInputField( |
|
160 | + 'wpUser', |
|
161 | + 'Int', |
|
162 | + null, |
|
163 | + esc_html__('Ticket Creator ID', 'event_espresso') |
|
164 | + ), |
|
165 | + new GraphQLOutputField( |
|
166 | + 'parent', |
|
167 | + 'Ticket', |
|
168 | + null, |
|
169 | + esc_html__('The parent ticket of the current ticket', 'event_espresso') |
|
170 | + ), |
|
171 | + new GraphQLInputField( |
|
172 | + 'parent', |
|
173 | + 'Int', |
|
174 | + null, |
|
175 | + esc_html__('The parent ticket ID', 'event_espresso') |
|
176 | + ), |
|
177 | + new GraphQLField( |
|
178 | + 'reverseCalculate', |
|
179 | + 'Boolean', |
|
180 | + 'reverse_calculate', |
|
181 | + esc_html__('Flag indicating whether ticket calculations should run in reverse and calculate the base ticket price from the provided ticket total.', 'event_espresso') |
|
182 | + ), |
|
183 | + new GraphQLField( |
|
184 | + 'isFree', |
|
185 | + 'Boolean', |
|
186 | + 'is_free', |
|
187 | + esc_html__('Flag indicating whether the ticket is free.', 'event_espresso') |
|
188 | + ), |
|
189 | + new GraphQLOutputField( |
|
190 | + 'event', |
|
191 | + 'Event', |
|
192 | + null, |
|
193 | + esc_html__('Event of the ticket.', 'event_espresso') |
|
194 | + ), |
|
195 | + ]; |
|
196 | + } |
|
197 | 197 | |
198 | 198 | |
199 | - /** |
|
200 | - * @param array $inputFields The mutation input fields. |
|
201 | - * |
|
202 | - * @throws InvalidArgumentException |
|
203 | - * @throws ReflectionException |
|
204 | - * @since $VID:$ |
|
205 | - */ |
|
206 | - public function registerMutations(array $inputFields) |
|
207 | - { |
|
208 | - // Register mutation to update an entity. |
|
209 | - register_graphql_mutation( |
|
199 | + /** |
|
200 | + * @param array $inputFields The mutation input fields. |
|
201 | + * |
|
202 | + * @throws InvalidArgumentException |
|
203 | + * @throws ReflectionException |
|
204 | + * @since $VID:$ |
|
205 | + */ |
|
206 | + public function registerMutations(array $inputFields) |
|
207 | + { |
|
208 | + // Register mutation to update an entity. |
|
209 | + register_graphql_mutation( |
|
210 | 210 | 'update' . $this->name(), |
211 | 211 | [ |
212 | 212 | 'inputFields' => $inputFields, |
213 | 213 | 'outputFields' => [ |
214 | - lcfirst($this->name()) => [ |
|
215 | - 'type' => $this->name(), |
|
216 | - 'resolve' => [$this, 'resolveFromPayload'], |
|
217 | - ], |
|
218 | - ], |
|
214 | + lcfirst($this->name()) => [ |
|
215 | + 'type' => $this->name(), |
|
216 | + 'resolve' => [$this, 'resolveFromPayload'], |
|
217 | + ], |
|
218 | + ], |
|
219 | 219 | 'mutateAndGetPayload' => TicketUpdate::mutateAndGetPayload($this->model, $this), |
220 | 220 | ] |
221 | - ); |
|
222 | - // Register mutation to delete an entity. |
|
223 | - register_graphql_mutation( |
|
221 | + ); |
|
222 | + // Register mutation to delete an entity. |
|
223 | + register_graphql_mutation( |
|
224 | 224 | 'delete' . $this->name(), |
225 | 225 | [ |
226 | 226 | 'inputFields' => [ |
227 | - 'id' => $inputFields['id'], |
|
228 | - 'deletePermanently' => [ |
|
229 | - 'type' => 'Boolean', |
|
230 | - 'description' => esc_html__( 'Whether to delete the entity permanently.', 'event_espresso' ), |
|
231 | - ], |
|
232 | - ], |
|
227 | + 'id' => $inputFields['id'], |
|
228 | + 'deletePermanently' => [ |
|
229 | + 'type' => 'Boolean', |
|
230 | + 'description' => esc_html__( 'Whether to delete the entity permanently.', 'event_espresso' ), |
|
231 | + ], |
|
232 | + ], |
|
233 | 233 | 'outputFields' => [ |
234 | - lcfirst($this->name()) => [ |
|
235 | - 'type' => $this->name(), |
|
236 | - 'description' => esc_html__( 'The object before it was deleted', 'event_espresso' ), |
|
237 | - 'resolve' => function ( $payload ) { |
|
238 | - $deleted = (object) $payload['deleted']; |
|
234 | + lcfirst($this->name()) => [ |
|
235 | + 'type' => $this->name(), |
|
236 | + 'description' => esc_html__( 'The object before it was deleted', 'event_espresso' ), |
|
237 | + 'resolve' => function ( $payload ) { |
|
238 | + $deleted = (object) $payload['deleted']; |
|
239 | 239 | |
240 | - return ! empty( $deleted ) ? $deleted : null; |
|
241 | - }, |
|
242 | - ], |
|
243 | - ], |
|
240 | + return ! empty( $deleted ) ? $deleted : null; |
|
241 | + }, |
|
242 | + ], |
|
243 | + ], |
|
244 | 244 | 'mutateAndGetPayload' => TicketDelete::mutateAndGetPayload($this->model, $this), |
245 | 245 | ] |
246 | - ); |
|
246 | + ); |
|
247 | 247 | |
248 | - // remove primary key from input. |
|
249 | - unset($inputFields['id']); |
|
250 | - // Register mutation to update an entity. |
|
251 | - register_graphql_mutation( |
|
248 | + // remove primary key from input. |
|
249 | + unset($inputFields['id']); |
|
250 | + // Register mutation to update an entity. |
|
251 | + register_graphql_mutation( |
|
252 | 252 | 'create' . $this->name(), |
253 | 253 | [ |
254 | 254 | 'inputFields' => $inputFields, |
255 | 255 | 'outputFields' => [ |
256 | - lcfirst($this->name()) => [ |
|
257 | - 'type' => $this->name(), |
|
258 | - 'resolve' => [$this, 'resolveFromPayload'], |
|
259 | - ], |
|
260 | - ], |
|
256 | + lcfirst($this->name()) => [ |
|
257 | + 'type' => $this->name(), |
|
258 | + 'resolve' => [$this, 'resolveFromPayload'], |
|
259 | + ], |
|
260 | + ], |
|
261 | 261 | 'mutateAndGetPayload' => TicketCreate::mutateAndGetPayload($this->model, $this), |
262 | 262 | ] |
263 | 263 | ); |
264 | - } |
|
264 | + } |
|
265 | 265 | } |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | { |
208 | 208 | // Register mutation to update an entity. |
209 | 209 | register_graphql_mutation( |
210 | - 'update' . $this->name(), |
|
210 | + 'update'.$this->name(), |
|
211 | 211 | [ |
212 | 212 | 'inputFields' => $inputFields, |
213 | 213 | 'outputFields' => [ |
@@ -221,23 +221,23 @@ discard block |
||
221 | 221 | ); |
222 | 222 | // Register mutation to delete an entity. |
223 | 223 | register_graphql_mutation( |
224 | - 'delete' . $this->name(), |
|
224 | + 'delete'.$this->name(), |
|
225 | 225 | [ |
226 | 226 | 'inputFields' => [ |
227 | 227 | 'id' => $inputFields['id'], |
228 | 228 | 'deletePermanently' => [ |
229 | 229 | 'type' => 'Boolean', |
230 | - 'description' => esc_html__( 'Whether to delete the entity permanently.', 'event_espresso' ), |
|
230 | + 'description' => esc_html__('Whether to delete the entity permanently.', 'event_espresso'), |
|
231 | 231 | ], |
232 | 232 | ], |
233 | 233 | 'outputFields' => [ |
234 | 234 | lcfirst($this->name()) => [ |
235 | 235 | 'type' => $this->name(), |
236 | - 'description' => esc_html__( 'The object before it was deleted', 'event_espresso' ), |
|
237 | - 'resolve' => function ( $payload ) { |
|
236 | + 'description' => esc_html__('The object before it was deleted', 'event_espresso'), |
|
237 | + 'resolve' => function($payload) { |
|
238 | 238 | $deleted = (object) $payload['deleted']; |
239 | 239 | |
240 | - return ! empty( $deleted ) ? $deleted : null; |
|
240 | + return ! empty($deleted) ? $deleted : null; |
|
241 | 241 | }, |
242 | 242 | ], |
243 | 243 | ], |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | unset($inputFields['id']); |
250 | 250 | // Register mutation to update an entity. |
251 | 251 | register_graphql_mutation( |
252 | - 'create' . $this->name(), |
|
252 | + 'create'.$this->name(), |
|
253 | 253 | [ |
254 | 254 | 'inputFields' => $inputFields, |
255 | 255 | 'outputFields' => [ |
@@ -21,182 +21,182 @@ |
||
21 | 21 | class Venue extends TypeBase |
22 | 22 | { |
23 | 23 | |
24 | - /** |
|
25 | - * Venue constructor. |
|
26 | - * |
|
27 | - * @param EEM_Venue $venue_model |
|
28 | - */ |
|
29 | - public function __construct(EEM_Venue $venue_model) |
|
30 | - { |
|
31 | - $this->model = $venue_model; |
|
32 | - $this->setName('Venue'); |
|
33 | - $this->setIsCustomPostType(true); |
|
34 | - parent::__construct(); |
|
35 | - } |
|
24 | + /** |
|
25 | + * Venue constructor. |
|
26 | + * |
|
27 | + * @param EEM_Venue $venue_model |
|
28 | + */ |
|
29 | + public function __construct(EEM_Venue $venue_model) |
|
30 | + { |
|
31 | + $this->model = $venue_model; |
|
32 | + $this->setName('Venue'); |
|
33 | + $this->setIsCustomPostType(true); |
|
34 | + parent::__construct(); |
|
35 | + } |
|
36 | 36 | |
37 | 37 | |
38 | - /** |
|
39 | - * @return GraphQLFieldInterface[] |
|
40 | - * @since $VID:$ |
|
41 | - */ |
|
42 | - public function getFields() |
|
43 | - { |
|
44 | - return [ |
|
45 | - new GraphQLField( |
|
46 | - 'name', |
|
47 | - 'String', |
|
48 | - 'name', |
|
49 | - esc_html__('Venue Name', 'event_espresso') |
|
50 | - ), |
|
51 | - new GraphQLField( |
|
52 | - 'desc', |
|
53 | - 'String', |
|
54 | - 'description', |
|
55 | - esc_html__('Venue Description', 'event_espresso') |
|
56 | - ), |
|
57 | - new GraphQLField( |
|
58 | - 'shortDesc', |
|
59 | - 'String', |
|
60 | - 'excerpt', |
|
61 | - esc_html__('Short Description of Venue', 'event_espresso') |
|
62 | - ), |
|
63 | - new GraphQLField( |
|
64 | - 'identifier', |
|
65 | - 'String', |
|
66 | - 'identifier', |
|
67 | - esc_html__('Venue Identifier', 'event_espresso') |
|
68 | - ), |
|
69 | - new GraphQLField( |
|
70 | - 'created', |
|
71 | - 'String', |
|
72 | - 'created', |
|
73 | - esc_html__('Date Venue Created', 'event_espresso') |
|
74 | - ), |
|
75 | - new GraphQLField( |
|
76 | - 'order', |
|
77 | - 'Int', |
|
78 | - 'order', |
|
79 | - esc_html__('Venue order', 'event_espresso') |
|
80 | - ), |
|
81 | - new GraphQLOutputField( |
|
82 | - 'wpUser', |
|
83 | - 'User', |
|
84 | - null, |
|
85 | - esc_html__('Venue Creator', 'event_espresso') |
|
86 | - ), |
|
87 | - new GraphQLInputField( |
|
88 | - 'wpUser', |
|
89 | - 'Int', |
|
90 | - null, |
|
91 | - esc_html__('Venue Creator ID', 'event_espresso') |
|
92 | - ), |
|
93 | - new GraphQLField( |
|
94 | - 'address', |
|
95 | - 'String', |
|
96 | - 'address', |
|
97 | - esc_html__('Venue Address line 1', 'event_espresso') |
|
98 | - ), |
|
99 | - new GraphQLField( |
|
100 | - 'address2', |
|
101 | - 'String', |
|
102 | - 'address2', |
|
103 | - esc_html__('Venue Address line 2', 'event_espresso') |
|
104 | - ), |
|
105 | - new GraphQLField( |
|
106 | - 'city', |
|
107 | - 'String', |
|
108 | - 'city', |
|
109 | - esc_html__('Venue City', 'event_espresso') |
|
110 | - ), |
|
111 | - new GraphQLOutputField( |
|
112 | - 'state', |
|
113 | - 'State', |
|
114 | - null, |
|
115 | - esc_html__('Venue state', 'event_espresso') |
|
116 | - ), |
|
117 | - new GraphQLInputField( |
|
118 | - 'state', |
|
119 | - 'Int', |
|
120 | - null, |
|
121 | - esc_html__('State ID', 'event_espresso') |
|
122 | - ), |
|
123 | - new GraphQLOutputField( |
|
124 | - 'country', |
|
125 | - 'Country', |
|
126 | - null, |
|
127 | - esc_html__('Venue country', 'event_espresso') |
|
128 | - ), |
|
129 | - new GraphQLInputField( |
|
130 | - 'country', |
|
131 | - 'String', |
|
132 | - null, |
|
133 | - esc_html__('Country ISO Code', 'event_espresso') |
|
134 | - ), |
|
135 | - new GraphQLField( |
|
136 | - 'zip', |
|
137 | - 'String', |
|
138 | - 'zip', |
|
139 | - esc_html__('Venue Zip/Postal Code', 'event_espresso') |
|
140 | - ), |
|
141 | - new GraphQLField( |
|
142 | - 'capacity', |
|
143 | - 'Int', |
|
144 | - 'capacity', |
|
145 | - esc_html__('Venue Capacity', 'event_espresso'), |
|
146 | - [$this, 'parseInfiniteValue'] |
|
147 | - ), |
|
148 | - new GraphQLField( |
|
149 | - 'phone', |
|
150 | - 'String', |
|
151 | - 'phone', |
|
152 | - esc_html__('Venue Phone', 'event_espresso') |
|
153 | - ), |
|
154 | - new GraphQLField( |
|
155 | - 'virtualPhone', |
|
156 | - 'String', |
|
157 | - 'virtual_phone', |
|
158 | - esc_html__('Call in Number', 'event_espresso') |
|
159 | - ), |
|
160 | - new GraphQLField( |
|
161 | - 'url', |
|
162 | - 'String', |
|
163 | - 'venue_url', |
|
164 | - esc_html__('Venue Website', 'event_espresso') |
|
165 | - ), |
|
166 | - new GraphQLField( |
|
167 | - 'virtualUrl', |
|
168 | - 'String', |
|
169 | - 'virtual_url', |
|
170 | - esc_html__('Virtual URL', 'event_espresso') |
|
171 | - ), |
|
172 | - new GraphQLField( |
|
173 | - 'googleMapLink', |
|
174 | - 'String', |
|
175 | - 'google_map_link', |
|
176 | - esc_html__('Google Map Link', 'event_espresso') |
|
177 | - ), |
|
178 | - new GraphQLField( |
|
179 | - 'enableForGmap', |
|
180 | - 'String', |
|
181 | - 'enable_for_gmap', |
|
182 | - esc_html__('Show Google Map?', 'event_espresso') |
|
183 | - ), |
|
184 | - ]; |
|
185 | - } |
|
38 | + /** |
|
39 | + * @return GraphQLFieldInterface[] |
|
40 | + * @since $VID:$ |
|
41 | + */ |
|
42 | + public function getFields() |
|
43 | + { |
|
44 | + return [ |
|
45 | + new GraphQLField( |
|
46 | + 'name', |
|
47 | + 'String', |
|
48 | + 'name', |
|
49 | + esc_html__('Venue Name', 'event_espresso') |
|
50 | + ), |
|
51 | + new GraphQLField( |
|
52 | + 'desc', |
|
53 | + 'String', |
|
54 | + 'description', |
|
55 | + esc_html__('Venue Description', 'event_espresso') |
|
56 | + ), |
|
57 | + new GraphQLField( |
|
58 | + 'shortDesc', |
|
59 | + 'String', |
|
60 | + 'excerpt', |
|
61 | + esc_html__('Short Description of Venue', 'event_espresso') |
|
62 | + ), |
|
63 | + new GraphQLField( |
|
64 | + 'identifier', |
|
65 | + 'String', |
|
66 | + 'identifier', |
|
67 | + esc_html__('Venue Identifier', 'event_espresso') |
|
68 | + ), |
|
69 | + new GraphQLField( |
|
70 | + 'created', |
|
71 | + 'String', |
|
72 | + 'created', |
|
73 | + esc_html__('Date Venue Created', 'event_espresso') |
|
74 | + ), |
|
75 | + new GraphQLField( |
|
76 | + 'order', |
|
77 | + 'Int', |
|
78 | + 'order', |
|
79 | + esc_html__('Venue order', 'event_espresso') |
|
80 | + ), |
|
81 | + new GraphQLOutputField( |
|
82 | + 'wpUser', |
|
83 | + 'User', |
|
84 | + null, |
|
85 | + esc_html__('Venue Creator', 'event_espresso') |
|
86 | + ), |
|
87 | + new GraphQLInputField( |
|
88 | + 'wpUser', |
|
89 | + 'Int', |
|
90 | + null, |
|
91 | + esc_html__('Venue Creator ID', 'event_espresso') |
|
92 | + ), |
|
93 | + new GraphQLField( |
|
94 | + 'address', |
|
95 | + 'String', |
|
96 | + 'address', |
|
97 | + esc_html__('Venue Address line 1', 'event_espresso') |
|
98 | + ), |
|
99 | + new GraphQLField( |
|
100 | + 'address2', |
|
101 | + 'String', |
|
102 | + 'address2', |
|
103 | + esc_html__('Venue Address line 2', 'event_espresso') |
|
104 | + ), |
|
105 | + new GraphQLField( |
|
106 | + 'city', |
|
107 | + 'String', |
|
108 | + 'city', |
|
109 | + esc_html__('Venue City', 'event_espresso') |
|
110 | + ), |
|
111 | + new GraphQLOutputField( |
|
112 | + 'state', |
|
113 | + 'State', |
|
114 | + null, |
|
115 | + esc_html__('Venue state', 'event_espresso') |
|
116 | + ), |
|
117 | + new GraphQLInputField( |
|
118 | + 'state', |
|
119 | + 'Int', |
|
120 | + null, |
|
121 | + esc_html__('State ID', 'event_espresso') |
|
122 | + ), |
|
123 | + new GraphQLOutputField( |
|
124 | + 'country', |
|
125 | + 'Country', |
|
126 | + null, |
|
127 | + esc_html__('Venue country', 'event_espresso') |
|
128 | + ), |
|
129 | + new GraphQLInputField( |
|
130 | + 'country', |
|
131 | + 'String', |
|
132 | + null, |
|
133 | + esc_html__('Country ISO Code', 'event_espresso') |
|
134 | + ), |
|
135 | + new GraphQLField( |
|
136 | + 'zip', |
|
137 | + 'String', |
|
138 | + 'zip', |
|
139 | + esc_html__('Venue Zip/Postal Code', 'event_espresso') |
|
140 | + ), |
|
141 | + new GraphQLField( |
|
142 | + 'capacity', |
|
143 | + 'Int', |
|
144 | + 'capacity', |
|
145 | + esc_html__('Venue Capacity', 'event_espresso'), |
|
146 | + [$this, 'parseInfiniteValue'] |
|
147 | + ), |
|
148 | + new GraphQLField( |
|
149 | + 'phone', |
|
150 | + 'String', |
|
151 | + 'phone', |
|
152 | + esc_html__('Venue Phone', 'event_espresso') |
|
153 | + ), |
|
154 | + new GraphQLField( |
|
155 | + 'virtualPhone', |
|
156 | + 'String', |
|
157 | + 'virtual_phone', |
|
158 | + esc_html__('Call in Number', 'event_espresso') |
|
159 | + ), |
|
160 | + new GraphQLField( |
|
161 | + 'url', |
|
162 | + 'String', |
|
163 | + 'venue_url', |
|
164 | + esc_html__('Venue Website', 'event_espresso') |
|
165 | + ), |
|
166 | + new GraphQLField( |
|
167 | + 'virtualUrl', |
|
168 | + 'String', |
|
169 | + 'virtual_url', |
|
170 | + esc_html__('Virtual URL', 'event_espresso') |
|
171 | + ), |
|
172 | + new GraphQLField( |
|
173 | + 'googleMapLink', |
|
174 | + 'String', |
|
175 | + 'google_map_link', |
|
176 | + esc_html__('Google Map Link', 'event_espresso') |
|
177 | + ), |
|
178 | + new GraphQLField( |
|
179 | + 'enableForGmap', |
|
180 | + 'String', |
|
181 | + 'enable_for_gmap', |
|
182 | + esc_html__('Show Google Map?', 'event_espresso') |
|
183 | + ), |
|
184 | + ]; |
|
185 | + } |
|
186 | 186 | |
187 | 187 | |
188 | - /** |
|
189 | - * Extends the existing WP GraphQL mutations. |
|
190 | - * |
|
191 | - * @since $VID:$ |
|
192 | - */ |
|
193 | - public function extendMutations() |
|
194 | - { |
|
195 | - add_action( |
|
196 | - 'graphql_post_object_mutation_update_additional_data', |
|
197 | - VenueUpdate::mutateFields($this->model, $this), |
|
198 | - 10, |
|
199 | - 6 |
|
200 | - ); |
|
201 | - } |
|
188 | + /** |
|
189 | + * Extends the existing WP GraphQL mutations. |
|
190 | + * |
|
191 | + * @since $VID:$ |
|
192 | + */ |
|
193 | + public function extendMutations() |
|
194 | + { |
|
195 | + add_action( |
|
196 | + 'graphql_post_object_mutation_update_additional_data', |
|
197 | + VenueUpdate::mutateFields($this->model, $this), |
|
198 | + 10, |
|
199 | + 6 |
|
200 | + ); |
|
201 | + } |
|
202 | 202 | } |
@@ -21,188 +21,188 @@ |
||
21 | 21 | class Event extends TypeBase |
22 | 22 | { |
23 | 23 | |
24 | - /** |
|
25 | - * Event constructor. |
|
26 | - * |
|
27 | - * @param EEM_Event $event_model |
|
28 | - */ |
|
29 | - public function __construct(EEM_Event $event_model) |
|
30 | - { |
|
31 | - $this->model = $event_model; |
|
32 | - $this->setName('Event'); |
|
33 | - $this->setIsCustomPostType(true); |
|
34 | - parent::__construct(); |
|
35 | - } |
|
24 | + /** |
|
25 | + * Event constructor. |
|
26 | + * |
|
27 | + * @param EEM_Event $event_model |
|
28 | + */ |
|
29 | + public function __construct(EEM_Event $event_model) |
|
30 | + { |
|
31 | + $this->model = $event_model; |
|
32 | + $this->setName('Event'); |
|
33 | + $this->setIsCustomPostType(true); |
|
34 | + parent::__construct(); |
|
35 | + } |
|
36 | 36 | |
37 | 37 | |
38 | - /** |
|
39 | - * @return GraphQLFieldInterface[] |
|
40 | - * @since $VID:$ |
|
41 | - */ |
|
42 | - public function getFields() |
|
43 | - { |
|
44 | - return [ |
|
45 | - new GraphQLField( |
|
46 | - 'name', |
|
47 | - 'String', |
|
48 | - 'name', |
|
49 | - esc_html__('Event Name', 'event_espresso') |
|
50 | - ), |
|
51 | - new GraphQLField( |
|
52 | - 'desc', |
|
53 | - 'String', |
|
54 | - 'description', |
|
55 | - esc_html__('Event Description', 'event_espresso') |
|
56 | - ), |
|
57 | - new GraphQLField( |
|
58 | - 'shortDesc', |
|
59 | - 'String', |
|
60 | - 'short_description', |
|
61 | - esc_html__('Event Short Description', 'event_espresso') |
|
62 | - ), |
|
63 | - new GraphQLField( |
|
64 | - 'created', |
|
65 | - 'String', |
|
66 | - 'created', |
|
67 | - esc_html__('Date/Time Event Created', 'event_espresso') |
|
68 | - ), |
|
69 | - new GraphQLOutputField( |
|
70 | - 'wpUser', |
|
71 | - 'User', |
|
72 | - null, |
|
73 | - esc_html__('Event Creator', 'event_espresso') |
|
74 | - ), |
|
75 | - new GraphQLInputField( |
|
76 | - 'wpUser', |
|
77 | - 'Int', |
|
78 | - null, |
|
79 | - esc_html__('Event Creator ID', 'event_espresso') |
|
80 | - ), |
|
81 | - new GraphQLField( |
|
82 | - 'order', |
|
83 | - 'Int', |
|
84 | - 'order', |
|
85 | - esc_html__('Event Menu Order', 'event_espresso') |
|
86 | - ), |
|
87 | - new GraphQLField( |
|
88 | - 'displayDesc', |
|
89 | - 'Boolean', |
|
90 | - 'display_description', |
|
91 | - esc_html__('Display Description Flag', 'event_espresso') |
|
92 | - ), |
|
93 | - new GraphQLField( |
|
94 | - 'displayTicketSelector', |
|
95 | - 'Boolean', |
|
96 | - 'display_ticket_selector', |
|
97 | - esc_html__('Display Ticket Selector Flag', 'event_espresso') |
|
98 | - ), |
|
99 | - new GraphQLField( |
|
100 | - 'visibleOn', |
|
101 | - 'String', |
|
102 | - 'visible_on', |
|
103 | - esc_html__('Event Visible Date', 'event_espresso') |
|
104 | - ), |
|
105 | - new GraphQLField( |
|
106 | - 'additionalLimit', |
|
107 | - 'String', |
|
108 | - 'additional_limit', |
|
109 | - esc_html__('Limit of Additional Registrations on Same Transaction', 'event_espresso') |
|
110 | - ), |
|
111 | - new GraphQLField( |
|
112 | - 'phone', |
|
113 | - 'String', |
|
114 | - 'phone', |
|
115 | - esc_html__('Event Phone Number', 'event_espresso') |
|
116 | - ), |
|
117 | - new GraphQLField( |
|
118 | - 'memberOnly', |
|
119 | - 'Boolean', |
|
120 | - 'member_only', |
|
121 | - esc_html__('Member-Only Event Flag', 'event_espresso') |
|
122 | - ), |
|
123 | - new GraphQLField( |
|
124 | - 'allowOverflow', |
|
125 | - 'Boolean', |
|
126 | - 'allow_overflow', |
|
127 | - esc_html__('Allow Overflow on Event', 'event_espresso') |
|
128 | - ), |
|
129 | - new GraphQLField( |
|
130 | - 'timezoneString', |
|
131 | - 'String', |
|
132 | - 'timezone_string', |
|
133 | - esc_html__('Timezone (name) for Event times', 'event_espresso') |
|
134 | - ), |
|
135 | - new GraphQLField( |
|
136 | - 'externalUrl', |
|
137 | - 'String', |
|
138 | - 'external_url', |
|
139 | - esc_html__('URL of Event Page if hosted elsewhere', 'event_espresso') |
|
140 | - ), |
|
141 | - new GraphQLField( |
|
142 | - 'donations', |
|
143 | - 'Boolean', |
|
144 | - 'donations', |
|
145 | - esc_html__('Accept Donations?', 'event_espresso') |
|
146 | - ), |
|
147 | - new GraphQLField( |
|
148 | - 'isSoldOut', |
|
149 | - 'Boolean', |
|
150 | - 'is_sold_out', |
|
151 | - esc_html__('Flag indicating whether the tickets sold for the event, met or exceed the registration limit', |
|
152 | - 'event_espresso') |
|
153 | - ), |
|
154 | - new GraphQLField( |
|
155 | - 'isPostponed', |
|
156 | - 'Boolean', |
|
157 | - 'is_postponed', |
|
158 | - esc_html__('Flag indicating whether the event is marked as postponed', 'event_espresso') |
|
159 | - ), |
|
160 | - new GraphQLField( |
|
161 | - 'isCancelled', |
|
162 | - 'Boolean', |
|
163 | - 'is_cancelled', |
|
164 | - esc_html__('Flag indicating whether the event is marked as cancelled', 'event_espresso') |
|
165 | - ), |
|
166 | - new GraphQLField( |
|
167 | - 'isUpcoming', |
|
168 | - 'Boolean', |
|
169 | - 'is_upcoming', |
|
170 | - esc_html__('Whether the event is upcoming', 'event_espresso') |
|
171 | - ), |
|
172 | - new GraphQLField( |
|
173 | - 'isActive', |
|
174 | - 'Boolean', |
|
175 | - 'is_active', |
|
176 | - esc_html__('Flag indicating event is active', 'event_espresso') |
|
177 | - ), |
|
178 | - new GraphQLField( |
|
179 | - 'isInactive', |
|
180 | - 'Boolean', |
|
181 | - 'is_inactive', |
|
182 | - esc_html__('Flag indicating event is inactive', 'event_espresso') |
|
183 | - ), |
|
184 | - new GraphQLField( |
|
185 | - 'isExpired', |
|
186 | - 'Boolean', |
|
187 | - 'is_expired', |
|
188 | - esc_html__('Flag indicating event is expired or not', 'event_espresso') |
|
189 | - ), |
|
190 | - ]; |
|
191 | - } |
|
38 | + /** |
|
39 | + * @return GraphQLFieldInterface[] |
|
40 | + * @since $VID:$ |
|
41 | + */ |
|
42 | + public function getFields() |
|
43 | + { |
|
44 | + return [ |
|
45 | + new GraphQLField( |
|
46 | + 'name', |
|
47 | + 'String', |
|
48 | + 'name', |
|
49 | + esc_html__('Event Name', 'event_espresso') |
|
50 | + ), |
|
51 | + new GraphQLField( |
|
52 | + 'desc', |
|
53 | + 'String', |
|
54 | + 'description', |
|
55 | + esc_html__('Event Description', 'event_espresso') |
|
56 | + ), |
|
57 | + new GraphQLField( |
|
58 | + 'shortDesc', |
|
59 | + 'String', |
|
60 | + 'short_description', |
|
61 | + esc_html__('Event Short Description', 'event_espresso') |
|
62 | + ), |
|
63 | + new GraphQLField( |
|
64 | + 'created', |
|
65 | + 'String', |
|
66 | + 'created', |
|
67 | + esc_html__('Date/Time Event Created', 'event_espresso') |
|
68 | + ), |
|
69 | + new GraphQLOutputField( |
|
70 | + 'wpUser', |
|
71 | + 'User', |
|
72 | + null, |
|
73 | + esc_html__('Event Creator', 'event_espresso') |
|
74 | + ), |
|
75 | + new GraphQLInputField( |
|
76 | + 'wpUser', |
|
77 | + 'Int', |
|
78 | + null, |
|
79 | + esc_html__('Event Creator ID', 'event_espresso') |
|
80 | + ), |
|
81 | + new GraphQLField( |
|
82 | + 'order', |
|
83 | + 'Int', |
|
84 | + 'order', |
|
85 | + esc_html__('Event Menu Order', 'event_espresso') |
|
86 | + ), |
|
87 | + new GraphQLField( |
|
88 | + 'displayDesc', |
|
89 | + 'Boolean', |
|
90 | + 'display_description', |
|
91 | + esc_html__('Display Description Flag', 'event_espresso') |
|
92 | + ), |
|
93 | + new GraphQLField( |
|
94 | + 'displayTicketSelector', |
|
95 | + 'Boolean', |
|
96 | + 'display_ticket_selector', |
|
97 | + esc_html__('Display Ticket Selector Flag', 'event_espresso') |
|
98 | + ), |
|
99 | + new GraphQLField( |
|
100 | + 'visibleOn', |
|
101 | + 'String', |
|
102 | + 'visible_on', |
|
103 | + esc_html__('Event Visible Date', 'event_espresso') |
|
104 | + ), |
|
105 | + new GraphQLField( |
|
106 | + 'additionalLimit', |
|
107 | + 'String', |
|
108 | + 'additional_limit', |
|
109 | + esc_html__('Limit of Additional Registrations on Same Transaction', 'event_espresso') |
|
110 | + ), |
|
111 | + new GraphQLField( |
|
112 | + 'phone', |
|
113 | + 'String', |
|
114 | + 'phone', |
|
115 | + esc_html__('Event Phone Number', 'event_espresso') |
|
116 | + ), |
|
117 | + new GraphQLField( |
|
118 | + 'memberOnly', |
|
119 | + 'Boolean', |
|
120 | + 'member_only', |
|
121 | + esc_html__('Member-Only Event Flag', 'event_espresso') |
|
122 | + ), |
|
123 | + new GraphQLField( |
|
124 | + 'allowOverflow', |
|
125 | + 'Boolean', |
|
126 | + 'allow_overflow', |
|
127 | + esc_html__('Allow Overflow on Event', 'event_espresso') |
|
128 | + ), |
|
129 | + new GraphQLField( |
|
130 | + 'timezoneString', |
|
131 | + 'String', |
|
132 | + 'timezone_string', |
|
133 | + esc_html__('Timezone (name) for Event times', 'event_espresso') |
|
134 | + ), |
|
135 | + new GraphQLField( |
|
136 | + 'externalUrl', |
|
137 | + 'String', |
|
138 | + 'external_url', |
|
139 | + esc_html__('URL of Event Page if hosted elsewhere', 'event_espresso') |
|
140 | + ), |
|
141 | + new GraphQLField( |
|
142 | + 'donations', |
|
143 | + 'Boolean', |
|
144 | + 'donations', |
|
145 | + esc_html__('Accept Donations?', 'event_espresso') |
|
146 | + ), |
|
147 | + new GraphQLField( |
|
148 | + 'isSoldOut', |
|
149 | + 'Boolean', |
|
150 | + 'is_sold_out', |
|
151 | + esc_html__('Flag indicating whether the tickets sold for the event, met or exceed the registration limit', |
|
152 | + 'event_espresso') |
|
153 | + ), |
|
154 | + new GraphQLField( |
|
155 | + 'isPostponed', |
|
156 | + 'Boolean', |
|
157 | + 'is_postponed', |
|
158 | + esc_html__('Flag indicating whether the event is marked as postponed', 'event_espresso') |
|
159 | + ), |
|
160 | + new GraphQLField( |
|
161 | + 'isCancelled', |
|
162 | + 'Boolean', |
|
163 | + 'is_cancelled', |
|
164 | + esc_html__('Flag indicating whether the event is marked as cancelled', 'event_espresso') |
|
165 | + ), |
|
166 | + new GraphQLField( |
|
167 | + 'isUpcoming', |
|
168 | + 'Boolean', |
|
169 | + 'is_upcoming', |
|
170 | + esc_html__('Whether the event is upcoming', 'event_espresso') |
|
171 | + ), |
|
172 | + new GraphQLField( |
|
173 | + 'isActive', |
|
174 | + 'Boolean', |
|
175 | + 'is_active', |
|
176 | + esc_html__('Flag indicating event is active', 'event_espresso') |
|
177 | + ), |
|
178 | + new GraphQLField( |
|
179 | + 'isInactive', |
|
180 | + 'Boolean', |
|
181 | + 'is_inactive', |
|
182 | + esc_html__('Flag indicating event is inactive', 'event_espresso') |
|
183 | + ), |
|
184 | + new GraphQLField( |
|
185 | + 'isExpired', |
|
186 | + 'Boolean', |
|
187 | + 'is_expired', |
|
188 | + esc_html__('Flag indicating event is expired or not', 'event_espresso') |
|
189 | + ), |
|
190 | + ]; |
|
191 | + } |
|
192 | 192 | |
193 | 193 | |
194 | - /** |
|
195 | - * Extends the existing WP GraphQL mutations. |
|
196 | - * |
|
197 | - * @since $VID:$ |
|
198 | - */ |
|
199 | - public function extendMutations() |
|
200 | - { |
|
201 | - add_action( |
|
202 | - 'graphql_post_object_mutation_update_additional_data', |
|
203 | - EventUpdate::mutateFields($this->model, $this), |
|
204 | - 10, |
|
205 | - 6 |
|
206 | - ); |
|
207 | - } |
|
194 | + /** |
|
195 | + * Extends the existing WP GraphQL mutations. |
|
196 | + * |
|
197 | + * @since $VID:$ |
|
198 | + */ |
|
199 | + public function extendMutations() |
|
200 | + { |
|
201 | + add_action( |
|
202 | + 'graphql_post_object_mutation_update_additional_data', |
|
203 | + EventUpdate::mutateFields($this->model, $this), |
|
204 | + 10, |
|
205 | + 6 |
|
206 | + ); |
|
207 | + } |
|
208 | 208 | } |
@@ -25,236 +25,236 @@ |
||
25 | 25 | class Datetime extends TypeBase |
26 | 26 | { |
27 | 27 | |
28 | - /** |
|
29 | - * EventDate constructor. |
|
30 | - * |
|
31 | - * @param EEM_Datetime $datetime_model |
|
32 | - */ |
|
33 | - public function __construct(EEM_Datetime $datetime_model) |
|
34 | - { |
|
35 | - $this->model = $datetime_model; |
|
36 | - $this->setName('Datetime'); |
|
37 | - $this->setDescription(__('An event date', 'event_espresso')); |
|
38 | - $this->setIsCustomPostType(false); |
|
39 | - parent::__construct(); |
|
40 | - } |
|
28 | + /** |
|
29 | + * EventDate constructor. |
|
30 | + * |
|
31 | + * @param EEM_Datetime $datetime_model |
|
32 | + */ |
|
33 | + public function __construct(EEM_Datetime $datetime_model) |
|
34 | + { |
|
35 | + $this->model = $datetime_model; |
|
36 | + $this->setName('Datetime'); |
|
37 | + $this->setDescription(__('An event date', 'event_espresso')); |
|
38 | + $this->setIsCustomPostType(false); |
|
39 | + parent::__construct(); |
|
40 | + } |
|
41 | 41 | |
42 | 42 | |
43 | - /** |
|
44 | - * @return GraphQLFieldInterface[] |
|
45 | - * @since $VID:$ |
|
46 | - */ |
|
47 | - public function getFields() |
|
48 | - { |
|
49 | - return [ |
|
50 | - new GraphQLField( |
|
51 | - 'id', |
|
52 | - ['non_null' => 'Int'], |
|
53 | - 'ID', |
|
54 | - esc_html__('The datetime ID.', 'event_espresso') |
|
55 | - ), |
|
56 | - new GraphQLField( |
|
57 | - 'name', |
|
58 | - 'String', |
|
59 | - 'name', |
|
60 | - esc_html__('Datetime Name', 'event_espresso') |
|
61 | - ), |
|
62 | - new GraphQLField( |
|
63 | - 'description', |
|
64 | - 'String', |
|
65 | - 'description', |
|
66 | - esc_html__('Description for Datetime', 'event_espresso') |
|
67 | - ), |
|
68 | - new GraphQLField( |
|
69 | - 'start', |
|
70 | - 'String', |
|
71 | - 'start', |
|
72 | - esc_html__('Start timestamp of Event', 'event_espresso') |
|
73 | - ), |
|
74 | - new GraphQLField( |
|
75 | - 'startDate', |
|
76 | - 'String', |
|
77 | - 'start_date', |
|
78 | - esc_html__('Start time/date of Event', 'event_espresso') |
|
79 | - ), |
|
80 | - new GraphQLField( |
|
81 | - 'end', |
|
82 | - 'String', |
|
83 | - 'end', |
|
84 | - esc_html__('End timestamp of Event', 'event_espresso') |
|
85 | - ), |
|
86 | - new GraphQLField( |
|
87 | - 'endDate', |
|
88 | - 'String', |
|
89 | - 'end_date', |
|
90 | - esc_html__('End time/date of Event', 'event_espresso') |
|
91 | - ), |
|
92 | - new GraphQLField( |
|
93 | - 'startTime', |
|
94 | - 'String', |
|
95 | - 'start_time', |
|
96 | - esc_html__('Start time of Event', 'event_espresso') |
|
97 | - ), |
|
98 | - new GraphQLField( |
|
99 | - 'endTime', |
|
100 | - 'String', |
|
101 | - 'end_time', |
|
102 | - esc_html__('End time of Event', 'event_espresso') |
|
103 | - ), |
|
104 | - new GraphQLField( |
|
105 | - 'capacity', |
|
106 | - 'Int', |
|
107 | - 'reg_limit', |
|
108 | - esc_html__('Registration Limit for this time', 'event_espresso'), |
|
109 | - [$this, 'parseInfiniteValue'] |
|
110 | - ), |
|
111 | - new GraphQLField( |
|
112 | - 'sold', |
|
113 | - 'Int', |
|
114 | - 'sold', |
|
115 | - esc_html__('How many sales for this Datetime that have occurred', 'event_espresso') |
|
116 | - ), |
|
117 | - new GraphQLField( |
|
118 | - 'reserved', |
|
119 | - 'Int', |
|
120 | - 'reserved', |
|
121 | - esc_html__('Quantity of tickets reserved, but not yet fully purchased', 'event_espresso') |
|
122 | - ), |
|
123 | - new GraphQLField( |
|
124 | - 'order', |
|
125 | - 'Int', |
|
126 | - 'order', |
|
127 | - esc_html__('The order in which the Datetime is displayed', 'event_espresso') |
|
128 | - ), |
|
129 | - new GraphQLField( |
|
130 | - 'length', |
|
131 | - 'Int', |
|
132 | - 'length', |
|
133 | - esc_html__('The length of the event (start to end time) in seconds', 'event_espresso') |
|
134 | - ), |
|
135 | - new GraphQLOutputField( |
|
136 | - 'parent', |
|
137 | - 'Datetime', |
|
138 | - null, |
|
139 | - esc_html__('The parent datetime of the current datetime', 'event_espresso') |
|
140 | - ), |
|
141 | - new GraphQLInputField( |
|
142 | - 'parent', |
|
143 | - 'Int', |
|
144 | - null, |
|
145 | - esc_html__('The parent datetime ID', 'event_espresso') |
|
146 | - ), |
|
147 | - new GraphQLField( |
|
148 | - 'isPrimary', |
|
149 | - 'Boolean', |
|
150 | - 'is_primary', |
|
151 | - esc_html__('Flag indicating datetime is primary one for event', 'event_espresso') |
|
152 | - ), |
|
153 | - new GraphQLField( |
|
154 | - 'isSoldOut', |
|
155 | - 'Boolean', |
|
156 | - 'sold_out', |
|
157 | - esc_html__('Flag indicating whether the tickets sold for this datetime, met or exceed the registration limit', |
|
158 | - 'event_espresso') |
|
159 | - ), |
|
160 | - new GraphQLField( |
|
161 | - 'isUpcoming', |
|
162 | - 'Boolean', |
|
163 | - 'is_upcoming', |
|
164 | - esc_html__('Whether the date is upcoming', 'event_espresso') |
|
165 | - ), |
|
166 | - new GraphQLField( |
|
167 | - 'isActive', |
|
168 | - 'Boolean', |
|
169 | - 'is_active', |
|
170 | - esc_html__('Flag indicating datetime is active', 'event_espresso') |
|
171 | - ), |
|
172 | - new GraphQLField( |
|
173 | - 'isExpired', |
|
174 | - 'Boolean', |
|
175 | - 'is_expired', |
|
176 | - esc_html__('Flag indicating datetime is expired or not', 'event_espresso') |
|
177 | - ), |
|
178 | - new GraphQLOutputField( |
|
179 | - 'event', |
|
180 | - 'Event', |
|
181 | - null, |
|
182 | - esc_html__('Event of the datetime.', 'event_espresso') |
|
183 | - ), |
|
184 | - new GraphQLInputField( |
|
185 | - 'event', |
|
186 | - 'Int', |
|
187 | - null, |
|
188 | - esc_html__('Event ID of the datetime.', 'event_espresso') |
|
189 | - ), |
|
190 | - ]; |
|
191 | - } |
|
43 | + /** |
|
44 | + * @return GraphQLFieldInterface[] |
|
45 | + * @since $VID:$ |
|
46 | + */ |
|
47 | + public function getFields() |
|
48 | + { |
|
49 | + return [ |
|
50 | + new GraphQLField( |
|
51 | + 'id', |
|
52 | + ['non_null' => 'Int'], |
|
53 | + 'ID', |
|
54 | + esc_html__('The datetime ID.', 'event_espresso') |
|
55 | + ), |
|
56 | + new GraphQLField( |
|
57 | + 'name', |
|
58 | + 'String', |
|
59 | + 'name', |
|
60 | + esc_html__('Datetime Name', 'event_espresso') |
|
61 | + ), |
|
62 | + new GraphQLField( |
|
63 | + 'description', |
|
64 | + 'String', |
|
65 | + 'description', |
|
66 | + esc_html__('Description for Datetime', 'event_espresso') |
|
67 | + ), |
|
68 | + new GraphQLField( |
|
69 | + 'start', |
|
70 | + 'String', |
|
71 | + 'start', |
|
72 | + esc_html__('Start timestamp of Event', 'event_espresso') |
|
73 | + ), |
|
74 | + new GraphQLField( |
|
75 | + 'startDate', |
|
76 | + 'String', |
|
77 | + 'start_date', |
|
78 | + esc_html__('Start time/date of Event', 'event_espresso') |
|
79 | + ), |
|
80 | + new GraphQLField( |
|
81 | + 'end', |
|
82 | + 'String', |
|
83 | + 'end', |
|
84 | + esc_html__('End timestamp of Event', 'event_espresso') |
|
85 | + ), |
|
86 | + new GraphQLField( |
|
87 | + 'endDate', |
|
88 | + 'String', |
|
89 | + 'end_date', |
|
90 | + esc_html__('End time/date of Event', 'event_espresso') |
|
91 | + ), |
|
92 | + new GraphQLField( |
|
93 | + 'startTime', |
|
94 | + 'String', |
|
95 | + 'start_time', |
|
96 | + esc_html__('Start time of Event', 'event_espresso') |
|
97 | + ), |
|
98 | + new GraphQLField( |
|
99 | + 'endTime', |
|
100 | + 'String', |
|
101 | + 'end_time', |
|
102 | + esc_html__('End time of Event', 'event_espresso') |
|
103 | + ), |
|
104 | + new GraphQLField( |
|
105 | + 'capacity', |
|
106 | + 'Int', |
|
107 | + 'reg_limit', |
|
108 | + esc_html__('Registration Limit for this time', 'event_espresso'), |
|
109 | + [$this, 'parseInfiniteValue'] |
|
110 | + ), |
|
111 | + new GraphQLField( |
|
112 | + 'sold', |
|
113 | + 'Int', |
|
114 | + 'sold', |
|
115 | + esc_html__('How many sales for this Datetime that have occurred', 'event_espresso') |
|
116 | + ), |
|
117 | + new GraphQLField( |
|
118 | + 'reserved', |
|
119 | + 'Int', |
|
120 | + 'reserved', |
|
121 | + esc_html__('Quantity of tickets reserved, but not yet fully purchased', 'event_espresso') |
|
122 | + ), |
|
123 | + new GraphQLField( |
|
124 | + 'order', |
|
125 | + 'Int', |
|
126 | + 'order', |
|
127 | + esc_html__('The order in which the Datetime is displayed', 'event_espresso') |
|
128 | + ), |
|
129 | + new GraphQLField( |
|
130 | + 'length', |
|
131 | + 'Int', |
|
132 | + 'length', |
|
133 | + esc_html__('The length of the event (start to end time) in seconds', 'event_espresso') |
|
134 | + ), |
|
135 | + new GraphQLOutputField( |
|
136 | + 'parent', |
|
137 | + 'Datetime', |
|
138 | + null, |
|
139 | + esc_html__('The parent datetime of the current datetime', 'event_espresso') |
|
140 | + ), |
|
141 | + new GraphQLInputField( |
|
142 | + 'parent', |
|
143 | + 'Int', |
|
144 | + null, |
|
145 | + esc_html__('The parent datetime ID', 'event_espresso') |
|
146 | + ), |
|
147 | + new GraphQLField( |
|
148 | + 'isPrimary', |
|
149 | + 'Boolean', |
|
150 | + 'is_primary', |
|
151 | + esc_html__('Flag indicating datetime is primary one for event', 'event_espresso') |
|
152 | + ), |
|
153 | + new GraphQLField( |
|
154 | + 'isSoldOut', |
|
155 | + 'Boolean', |
|
156 | + 'sold_out', |
|
157 | + esc_html__('Flag indicating whether the tickets sold for this datetime, met or exceed the registration limit', |
|
158 | + 'event_espresso') |
|
159 | + ), |
|
160 | + new GraphQLField( |
|
161 | + 'isUpcoming', |
|
162 | + 'Boolean', |
|
163 | + 'is_upcoming', |
|
164 | + esc_html__('Whether the date is upcoming', 'event_espresso') |
|
165 | + ), |
|
166 | + new GraphQLField( |
|
167 | + 'isActive', |
|
168 | + 'Boolean', |
|
169 | + 'is_active', |
|
170 | + esc_html__('Flag indicating datetime is active', 'event_espresso') |
|
171 | + ), |
|
172 | + new GraphQLField( |
|
173 | + 'isExpired', |
|
174 | + 'Boolean', |
|
175 | + 'is_expired', |
|
176 | + esc_html__('Flag indicating datetime is expired or not', 'event_espresso') |
|
177 | + ), |
|
178 | + new GraphQLOutputField( |
|
179 | + 'event', |
|
180 | + 'Event', |
|
181 | + null, |
|
182 | + esc_html__('Event of the datetime.', 'event_espresso') |
|
183 | + ), |
|
184 | + new GraphQLInputField( |
|
185 | + 'event', |
|
186 | + 'Int', |
|
187 | + null, |
|
188 | + esc_html__('Event ID of the datetime.', 'event_espresso') |
|
189 | + ), |
|
190 | + ]; |
|
191 | + } |
|
192 | 192 | |
193 | 193 | |
194 | - /** |
|
195 | - * @param array $inputFields The mutation input fields. |
|
196 | - * |
|
197 | - * @throws InvalidArgumentException |
|
198 | - * @throws ReflectionException |
|
199 | - * @since $VID:$ |
|
200 | - */ |
|
201 | - public function registerMutations(array $inputFields) |
|
202 | - { |
|
203 | - // Register mutation to update an entity. |
|
204 | - register_graphql_mutation( |
|
194 | + /** |
|
195 | + * @param array $inputFields The mutation input fields. |
|
196 | + * |
|
197 | + * @throws InvalidArgumentException |
|
198 | + * @throws ReflectionException |
|
199 | + * @since $VID:$ |
|
200 | + */ |
|
201 | + public function registerMutations(array $inputFields) |
|
202 | + { |
|
203 | + // Register mutation to update an entity. |
|
204 | + register_graphql_mutation( |
|
205 | 205 | 'update' . $this->name(), |
206 | 206 | [ |
207 | 207 | 'inputFields' => $inputFields, |
208 | 208 | 'outputFields' => [ |
209 | - lcfirst($this->name()) => [ |
|
210 | - 'type' => $this->name(), |
|
211 | - 'resolve' => [$this, 'resolveFromPayload'], |
|
212 | - ], |
|
213 | - ], |
|
209 | + lcfirst($this->name()) => [ |
|
210 | + 'type' => $this->name(), |
|
211 | + 'resolve' => [$this, 'resolveFromPayload'], |
|
212 | + ], |
|
213 | + ], |
|
214 | 214 | 'mutateAndGetPayload' => DatetimeUpdate::mutateAndGetPayload($this->model, $this), |
215 | 215 | ] |
216 | - ); |
|
217 | - // Register mutation to delete an entity. |
|
218 | - register_graphql_mutation( |
|
216 | + ); |
|
217 | + // Register mutation to delete an entity. |
|
218 | + register_graphql_mutation( |
|
219 | 219 | 'delete' . $this->name(), |
220 | 220 | [ |
221 | 221 | 'inputFields' => [ |
222 | - 'id' => $inputFields['id'], |
|
223 | - 'deletePermanently' => [ |
|
224 | - 'type' => 'Boolean', |
|
225 | - 'description' => esc_html__( 'Whether to delete the entity permanently.', 'event_espresso' ), |
|
226 | - ], |
|
227 | - ], |
|
222 | + 'id' => $inputFields['id'], |
|
223 | + 'deletePermanently' => [ |
|
224 | + 'type' => 'Boolean', |
|
225 | + 'description' => esc_html__( 'Whether to delete the entity permanently.', 'event_espresso' ), |
|
226 | + ], |
|
227 | + ], |
|
228 | 228 | 'outputFields' => [ |
229 | - lcfirst($this->name()) => [ |
|
230 | - 'type' => $this->name(), |
|
231 | - 'description' => esc_html__( 'The object before it was deleted', 'event_espresso' ), |
|
232 | - 'resolve' => function ( $payload ) { |
|
233 | - $deleted = (object) $payload['deleted']; |
|
229 | + lcfirst($this->name()) => [ |
|
230 | + 'type' => $this->name(), |
|
231 | + 'description' => esc_html__( 'The object before it was deleted', 'event_espresso' ), |
|
232 | + 'resolve' => function ( $payload ) { |
|
233 | + $deleted = (object) $payload['deleted']; |
|
234 | 234 | |
235 | - return ! empty( $deleted ) ? $deleted : null; |
|
236 | - }, |
|
237 | - ], |
|
238 | - ], |
|
235 | + return ! empty( $deleted ) ? $deleted : null; |
|
236 | + }, |
|
237 | + ], |
|
238 | + ], |
|
239 | 239 | 'mutateAndGetPayload' => DatetimeDelete::mutateAndGetPayload($this->model, $this), |
240 | 240 | ] |
241 | - ); |
|
241 | + ); |
|
242 | 242 | |
243 | - // remove primary key from input. |
|
244 | - unset($inputFields['id']); |
|
245 | - // Register mutation to update an entity. |
|
246 | - register_graphql_mutation( |
|
243 | + // remove primary key from input. |
|
244 | + unset($inputFields['id']); |
|
245 | + // Register mutation to update an entity. |
|
246 | + register_graphql_mutation( |
|
247 | 247 | 'create' . $this->name(), |
248 | 248 | [ |
249 | 249 | 'inputFields' => $inputFields, |
250 | 250 | 'outputFields' => [ |
251 | - lcfirst($this->name()) => [ |
|
252 | - 'type' => $this->name(), |
|
253 | - 'resolve' => [$this, 'resolveFromPayload'], |
|
254 | - ], |
|
255 | - ], |
|
251 | + lcfirst($this->name()) => [ |
|
252 | + 'type' => $this->name(), |
|
253 | + 'resolve' => [$this, 'resolveFromPayload'], |
|
254 | + ], |
|
255 | + ], |
|
256 | 256 | 'mutateAndGetPayload' => DatetimeCreate::mutateAndGetPayload($this->model, $this), |
257 | 257 | ] |
258 | 258 | ); |
259 | - } |
|
259 | + } |
|
260 | 260 | } |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | { |
203 | 203 | // Register mutation to update an entity. |
204 | 204 | register_graphql_mutation( |
205 | - 'update' . $this->name(), |
|
205 | + 'update'.$this->name(), |
|
206 | 206 | [ |
207 | 207 | 'inputFields' => $inputFields, |
208 | 208 | 'outputFields' => [ |
@@ -216,23 +216,23 @@ discard block |
||
216 | 216 | ); |
217 | 217 | // Register mutation to delete an entity. |
218 | 218 | register_graphql_mutation( |
219 | - 'delete' . $this->name(), |
|
219 | + 'delete'.$this->name(), |
|
220 | 220 | [ |
221 | 221 | 'inputFields' => [ |
222 | 222 | 'id' => $inputFields['id'], |
223 | 223 | 'deletePermanently' => [ |
224 | 224 | 'type' => 'Boolean', |
225 | - 'description' => esc_html__( 'Whether to delete the entity permanently.', 'event_espresso' ), |
|
225 | + 'description' => esc_html__('Whether to delete the entity permanently.', 'event_espresso'), |
|
226 | 226 | ], |
227 | 227 | ], |
228 | 228 | 'outputFields' => [ |
229 | 229 | lcfirst($this->name()) => [ |
230 | 230 | 'type' => $this->name(), |
231 | - 'description' => esc_html__( 'The object before it was deleted', 'event_espresso' ), |
|
232 | - 'resolve' => function ( $payload ) { |
|
231 | + 'description' => esc_html__('The object before it was deleted', 'event_espresso'), |
|
232 | + 'resolve' => function($payload) { |
|
233 | 233 | $deleted = (object) $payload['deleted']; |
234 | 234 | |
235 | - return ! empty( $deleted ) ? $deleted : null; |
|
235 | + return ! empty($deleted) ? $deleted : null; |
|
236 | 236 | }, |
237 | 237 | ], |
238 | 238 | ], |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | unset($inputFields['id']); |
245 | 245 | // Register mutation to update an entity. |
246 | 246 | register_graphql_mutation( |
247 | - 'create' . $this->name(), |
|
247 | + 'create'.$this->name(), |
|
248 | 248 | [ |
249 | 249 | 'inputFields' => $inputFields, |
250 | 250 | 'outputFields' => [ |
@@ -20,65 +20,65 @@ |
||
20 | 20 | class State extends TypeBase |
21 | 21 | { |
22 | 22 | |
23 | - /** |
|
24 | - * State constructor. |
|
25 | - * |
|
26 | - * @param EEM_State $state_model |
|
27 | - */ |
|
28 | - public function __construct(EEM_State $state_model) |
|
29 | - { |
|
30 | - $this->model = $state_model; |
|
31 | - $this->setName('State'); |
|
32 | - $this->setDescription(__('A state', 'event_espresso')); |
|
33 | - $this->setIsCustomPostType(false); |
|
23 | + /** |
|
24 | + * State constructor. |
|
25 | + * |
|
26 | + * @param EEM_State $state_model |
|
27 | + */ |
|
28 | + public function __construct(EEM_State $state_model) |
|
29 | + { |
|
30 | + $this->model = $state_model; |
|
31 | + $this->setName('State'); |
|
32 | + $this->setDescription(__('A state', 'event_espresso')); |
|
33 | + $this->setIsCustomPostType(false); |
|
34 | 34 | |
35 | - parent::__construct(); |
|
36 | - } |
|
35 | + parent::__construct(); |
|
36 | + } |
|
37 | 37 | |
38 | 38 | |
39 | - /** |
|
40 | - * @return GraphQLFieldInterface[] |
|
41 | - * @since $VID:$ |
|
42 | - */ |
|
43 | - public function getFields() |
|
44 | - { |
|
45 | - return [ |
|
46 | - new GraphQLField( |
|
47 | - 'id', |
|
48 | - ['non_null' => 'Int'], |
|
49 | - 'ID', |
|
50 | - esc_html__('State ID', 'event_espresso') |
|
51 | - ), |
|
52 | - new GraphQLField( |
|
53 | - 'abbreviation', |
|
54 | - 'String', |
|
55 | - 'abbrev', |
|
56 | - esc_html__('State Abbreviation', 'event_espresso') |
|
57 | - ), |
|
58 | - new GraphQLField( |
|
59 | - 'name', |
|
60 | - 'String', |
|
61 | - 'name', |
|
62 | - esc_html__('State Name', 'event_espresso') |
|
63 | - ), |
|
64 | - new GraphQLField( |
|
65 | - 'isActive', |
|
66 | - 'Boolean', |
|
67 | - 'active', |
|
68 | - esc_html__('State Active Flag', 'event_espresso') |
|
69 | - ), |
|
70 | - new GraphQLOutputField( |
|
71 | - 'country', |
|
72 | - 'Country', |
|
73 | - null, |
|
74 | - esc_html__('Country for the state', 'event_espresso') |
|
75 | - ), |
|
76 | - new GraphQLInputField( |
|
77 | - 'country', |
|
78 | - 'String', |
|
79 | - null, |
|
80 | - esc_html__('Country ISO Code', 'event_espresso') |
|
81 | - ), |
|
82 | - ]; |
|
83 | - } |
|
39 | + /** |
|
40 | + * @return GraphQLFieldInterface[] |
|
41 | + * @since $VID:$ |
|
42 | + */ |
|
43 | + public function getFields() |
|
44 | + { |
|
45 | + return [ |
|
46 | + new GraphQLField( |
|
47 | + 'id', |
|
48 | + ['non_null' => 'Int'], |
|
49 | + 'ID', |
|
50 | + esc_html__('State ID', 'event_espresso') |
|
51 | + ), |
|
52 | + new GraphQLField( |
|
53 | + 'abbreviation', |
|
54 | + 'String', |
|
55 | + 'abbrev', |
|
56 | + esc_html__('State Abbreviation', 'event_espresso') |
|
57 | + ), |
|
58 | + new GraphQLField( |
|
59 | + 'name', |
|
60 | + 'String', |
|
61 | + 'name', |
|
62 | + esc_html__('State Name', 'event_espresso') |
|
63 | + ), |
|
64 | + new GraphQLField( |
|
65 | + 'isActive', |
|
66 | + 'Boolean', |
|
67 | + 'active', |
|
68 | + esc_html__('State Active Flag', 'event_espresso') |
|
69 | + ), |
|
70 | + new GraphQLOutputField( |
|
71 | + 'country', |
|
72 | + 'Country', |
|
73 | + null, |
|
74 | + esc_html__('Country for the state', 'event_espresso') |
|
75 | + ), |
|
76 | + new GraphQLInputField( |
|
77 | + 'country', |
|
78 | + 'String', |
|
79 | + null, |
|
80 | + esc_html__('Country ISO Code', 'event_espresso') |
|
81 | + ), |
|
82 | + ]; |
|
83 | + } |
|
84 | 84 | } |
@@ -18,99 +18,99 @@ |
||
18 | 18 | class Country extends TypeBase |
19 | 19 | { |
20 | 20 | |
21 | - /** |
|
22 | - * Country constructor. |
|
23 | - * |
|
24 | - * @param EEM_Country $country_model |
|
25 | - */ |
|
26 | - public function __construct(EEM_Country $country_model) |
|
27 | - { |
|
28 | - $this->model = $country_model; |
|
29 | - $this->setName('Country'); |
|
30 | - $this->setDescription(__('A country', 'event_espresso')); |
|
31 | - $this->setIsCustomPostType(false); |
|
32 | - parent::__construct(); |
|
33 | - } |
|
21 | + /** |
|
22 | + * Country constructor. |
|
23 | + * |
|
24 | + * @param EEM_Country $country_model |
|
25 | + */ |
|
26 | + public function __construct(EEM_Country $country_model) |
|
27 | + { |
|
28 | + $this->model = $country_model; |
|
29 | + $this->setName('Country'); |
|
30 | + $this->setDescription(__('A country', 'event_espresso')); |
|
31 | + $this->setIsCustomPostType(false); |
|
32 | + parent::__construct(); |
|
33 | + } |
|
34 | 34 | |
35 | 35 | |
36 | - /** |
|
37 | - * @return GraphQLFieldInterface[] |
|
38 | - * @since $VID:$ |
|
39 | - */ |
|
40 | - public function getFields() |
|
41 | - { |
|
42 | - return [ |
|
43 | - new GraphQLField( |
|
44 | - 'isActive', |
|
45 | - 'Boolean', |
|
46 | - null, // 'active', |
|
47 | - esc_html__('Flag that indicates if the country should appear in dropdown select lists', 'event_espresso') |
|
48 | - ), |
|
49 | - new GraphQLField( |
|
50 | - 'ISO', |
|
51 | - 'String', |
|
52 | - null, //'ISO', |
|
53 | - esc_html__('Country ISO Code', 'event_espresso') |
|
54 | - ), |
|
55 | - new GraphQLField( |
|
56 | - 'ISO3', |
|
57 | - 'String', |
|
58 | - null, //'ISO3', |
|
59 | - esc_html__('Country ISO3 Code', 'event_espresso') |
|
60 | - ), |
|
61 | - new GraphQLField( |
|
62 | - 'name', |
|
63 | - 'String', |
|
64 | - 'name', |
|
65 | - esc_html__('Country Name', 'event_espresso') |
|
66 | - ), |
|
67 | - new GraphQLField( |
|
68 | - 'currencyCode', |
|
69 | - 'String', |
|
70 | - 'currency_code', |
|
71 | - esc_html__('Country Currency Code', 'event_espresso') |
|
72 | - ), |
|
73 | - new GraphQLField( |
|
74 | - 'currencySingular', |
|
75 | - 'String', |
|
76 | - 'currency_name_single', |
|
77 | - esc_html__('Currency Name Singular', 'event_espresso') |
|
78 | - ), |
|
79 | - new GraphQLField( |
|
80 | - 'currencyPlural', |
|
81 | - 'String', |
|
82 | - 'currency_name_plural', |
|
83 | - esc_html__('Currency Name Plural', 'event_espresso') |
|
84 | - ), |
|
85 | - new GraphQLField( |
|
86 | - 'currencySign', |
|
87 | - 'String', |
|
88 | - 'currency_sign',__('Currency Sign', 'event_espresso') |
|
89 | - ), |
|
90 | - new GraphQLField( |
|
91 | - 'currencySignBeforeNumber', |
|
92 | - 'String', |
|
93 | - 'currency_sign_before', |
|
94 | - esc_html__('Currency Sign Before Number', 'event_espresso') |
|
95 | - ), |
|
96 | - new GraphQLField( |
|
97 | - 'currencyDecimalPlaces', |
|
98 | - 'String', |
|
99 | - 'currency_decimal_places', |
|
100 | - esc_html__('Currency Decimal Places', 'event_espresso') |
|
101 | - ), |
|
102 | - new GraphQLField( |
|
103 | - 'currencyDecimalMark', |
|
104 | - 'String', |
|
105 | - 'currency_decimal_mark', |
|
106 | - esc_html__('Currency Decimal Mark', 'event_espresso') |
|
107 | - ), |
|
108 | - new GraphQLField( |
|
109 | - 'currencyThousandsSeparator', |
|
110 | - 'String', |
|
111 | - 'currency_thousands_separator', |
|
112 | - esc_html__('Currency Thousands Separator', 'event_espresso') |
|
113 | - ), |
|
114 | - ]; |
|
115 | - } |
|
36 | + /** |
|
37 | + * @return GraphQLFieldInterface[] |
|
38 | + * @since $VID:$ |
|
39 | + */ |
|
40 | + public function getFields() |
|
41 | + { |
|
42 | + return [ |
|
43 | + new GraphQLField( |
|
44 | + 'isActive', |
|
45 | + 'Boolean', |
|
46 | + null, // 'active', |
|
47 | + esc_html__('Flag that indicates if the country should appear in dropdown select lists', 'event_espresso') |
|
48 | + ), |
|
49 | + new GraphQLField( |
|
50 | + 'ISO', |
|
51 | + 'String', |
|
52 | + null, //'ISO', |
|
53 | + esc_html__('Country ISO Code', 'event_espresso') |
|
54 | + ), |
|
55 | + new GraphQLField( |
|
56 | + 'ISO3', |
|
57 | + 'String', |
|
58 | + null, //'ISO3', |
|
59 | + esc_html__('Country ISO3 Code', 'event_espresso') |
|
60 | + ), |
|
61 | + new GraphQLField( |
|
62 | + 'name', |
|
63 | + 'String', |
|
64 | + 'name', |
|
65 | + esc_html__('Country Name', 'event_espresso') |
|
66 | + ), |
|
67 | + new GraphQLField( |
|
68 | + 'currencyCode', |
|
69 | + 'String', |
|
70 | + 'currency_code', |
|
71 | + esc_html__('Country Currency Code', 'event_espresso') |
|
72 | + ), |
|
73 | + new GraphQLField( |
|
74 | + 'currencySingular', |
|
75 | + 'String', |
|
76 | + 'currency_name_single', |
|
77 | + esc_html__('Currency Name Singular', 'event_espresso') |
|
78 | + ), |
|
79 | + new GraphQLField( |
|
80 | + 'currencyPlural', |
|
81 | + 'String', |
|
82 | + 'currency_name_plural', |
|
83 | + esc_html__('Currency Name Plural', 'event_espresso') |
|
84 | + ), |
|
85 | + new GraphQLField( |
|
86 | + 'currencySign', |
|
87 | + 'String', |
|
88 | + 'currency_sign',__('Currency Sign', 'event_espresso') |
|
89 | + ), |
|
90 | + new GraphQLField( |
|
91 | + 'currencySignBeforeNumber', |
|
92 | + 'String', |
|
93 | + 'currency_sign_before', |
|
94 | + esc_html__('Currency Sign Before Number', 'event_espresso') |
|
95 | + ), |
|
96 | + new GraphQLField( |
|
97 | + 'currencyDecimalPlaces', |
|
98 | + 'String', |
|
99 | + 'currency_decimal_places', |
|
100 | + esc_html__('Currency Decimal Places', 'event_espresso') |
|
101 | + ), |
|
102 | + new GraphQLField( |
|
103 | + 'currencyDecimalMark', |
|
104 | + 'String', |
|
105 | + 'currency_decimal_mark', |
|
106 | + esc_html__('Currency Decimal Mark', 'event_espresso') |
|
107 | + ), |
|
108 | + new GraphQLField( |
|
109 | + 'currencyThousandsSeparator', |
|
110 | + 'String', |
|
111 | + 'currency_thousands_separator', |
|
112 | + esc_html__('Currency Thousands Separator', 'event_espresso') |
|
113 | + ), |
|
114 | + ]; |
|
115 | + } |
|
116 | 116 | } |
@@ -18,110 +18,110 @@ |
||
18 | 18 | class TypesManager |
19 | 19 | { |
20 | 20 | |
21 | - /** |
|
22 | - * @var TypeCollection|TypeInterface[] $types |
|
23 | - */ |
|
24 | - private $types; |
|
21 | + /** |
|
22 | + * @var TypeCollection|TypeInterface[] $types |
|
23 | + */ |
|
24 | + private $types; |
|
25 | 25 | |
26 | 26 | |
27 | - /** |
|
28 | - * TypesManager constructor. |
|
29 | - * |
|
30 | - * @param TypeCollection|TypeInterface[] $types |
|
31 | - */ |
|
32 | - public function __construct(TypeCollection $types) |
|
33 | - { |
|
34 | - $this->types = $types; |
|
35 | - } |
|
27 | + /** |
|
28 | + * TypesManager constructor. |
|
29 | + * |
|
30 | + * @param TypeCollection|TypeInterface[] $types |
|
31 | + */ |
|
32 | + public function __construct(TypeCollection $types) |
|
33 | + { |
|
34 | + $this->types = $types; |
|
35 | + } |
|
36 | 36 | |
37 | 37 | |
38 | - /** |
|
39 | - * @throws CollectionDetailsException |
|
40 | - * @throws CollectionLoaderException |
|
41 | - * @since $VID:$ |
|
42 | - */ |
|
43 | - public function init() |
|
44 | - { |
|
45 | - $this->types->loadTypes(); |
|
46 | - add_action('graphql_register_types', [$this, 'configureTypes'], 10); |
|
47 | - } |
|
38 | + /** |
|
39 | + * @throws CollectionDetailsException |
|
40 | + * @throws CollectionLoaderException |
|
41 | + * @since $VID:$ |
|
42 | + */ |
|
43 | + public function init() |
|
44 | + { |
|
45 | + $this->types->loadTypes(); |
|
46 | + add_action('graphql_register_types', [$this, 'configureTypes'], 10); |
|
47 | + } |
|
48 | 48 | |
49 | 49 | |
50 | - /** |
|
51 | - * @since $VID:$ |
|
52 | - */ |
|
53 | - public function configureTypes() |
|
54 | - { |
|
55 | - // loop through the collection of types and register their fields |
|
56 | - foreach ($this->types as $type) { |
|
57 | - if ($type->isCustomPostType()) { |
|
58 | - $this->extendCustomPostType($type); |
|
59 | - } else { |
|
60 | - $this->registerType($type); |
|
61 | - } |
|
62 | - } |
|
63 | - } |
|
50 | + /** |
|
51 | + * @since $VID:$ |
|
52 | + */ |
|
53 | + public function configureTypes() |
|
54 | + { |
|
55 | + // loop through the collection of types and register their fields |
|
56 | + foreach ($this->types as $type) { |
|
57 | + if ($type->isCustomPostType()) { |
|
58 | + $this->extendCustomPostType($type); |
|
59 | + } else { |
|
60 | + $this->registerType($type); |
|
61 | + } |
|
62 | + } |
|
63 | + } |
|
64 | 64 | |
65 | 65 | |
66 | - /** |
|
67 | - * @param TypeInterface $type |
|
68 | - * @since $VID:$ |
|
69 | - */ |
|
70 | - public function extendCustomPostType(TypeInterface $type) |
|
71 | - { |
|
72 | - $typeName = $type->name(); |
|
73 | - foreach ($type->fields() as $field) { |
|
74 | - $fieldName = $field->name(); |
|
75 | - $config = $field->toArray(); |
|
76 | - if ($field->useForInput()) { |
|
77 | - // Register input fields for existing mutations. |
|
78 | - register_graphql_field('Update' . $typeName . 'Input', $fieldName, $config); |
|
79 | - register_graphql_field('Create' . $typeName . 'Input', $fieldName, $config); |
|
80 | - } |
|
81 | - if ($field->useForOutput()) { |
|
82 | - $config['resolve'] = [$type, 'resolveField']; |
|
83 | - // Register fields for queries. |
|
84 | - register_graphql_field($typeName, $fieldName, $config); |
|
85 | - } |
|
86 | - } |
|
87 | - if (is_callable([$type, 'extendMutations'])) { |
|
88 | - $type->extendMutations(); |
|
89 | - } |
|
90 | - } |
|
66 | + /** |
|
67 | + * @param TypeInterface $type |
|
68 | + * @since $VID:$ |
|
69 | + */ |
|
70 | + public function extendCustomPostType(TypeInterface $type) |
|
71 | + { |
|
72 | + $typeName = $type->name(); |
|
73 | + foreach ($type->fields() as $field) { |
|
74 | + $fieldName = $field->name(); |
|
75 | + $config = $field->toArray(); |
|
76 | + if ($field->useForInput()) { |
|
77 | + // Register input fields for existing mutations. |
|
78 | + register_graphql_field('Update' . $typeName . 'Input', $fieldName, $config); |
|
79 | + register_graphql_field('Create' . $typeName . 'Input', $fieldName, $config); |
|
80 | + } |
|
81 | + if ($field->useForOutput()) { |
|
82 | + $config['resolve'] = [$type, 'resolveField']; |
|
83 | + // Register fields for queries. |
|
84 | + register_graphql_field($typeName, $fieldName, $config); |
|
85 | + } |
|
86 | + } |
|
87 | + if (is_callable([$type, 'extendMutations'])) { |
|
88 | + $type->extendMutations(); |
|
89 | + } |
|
90 | + } |
|
91 | 91 | |
92 | 92 | |
93 | - /** |
|
94 | - * @param TypeInterface $type |
|
95 | - * @since $VID:$ |
|
96 | - */ |
|
97 | - public function registerType(TypeInterface $type) |
|
98 | - { |
|
99 | - $outputFields = []; |
|
100 | - $inputFields = []; |
|
101 | - foreach ($type->fields() as $field) { |
|
102 | - $fieldName = $field->name(); |
|
103 | - $config = $field->toArray(); |
|
104 | - if ($field->useForInput()) { |
|
105 | - $inputFields[$fieldName] = $config; |
|
106 | - } |
|
107 | - if ($field->useForOutput()) { |
|
108 | - $config['resolve'] = [$type, 'resolveField']; |
|
109 | - $outputFields[$fieldName] = $config; |
|
110 | - } |
|
111 | - } |
|
112 | - $typeName = $type->name(); |
|
113 | - if (! empty($outputFields)) { |
|
114 | - // Register the object type. |
|
115 | - register_graphql_object_type( |
|
116 | - $typeName, |
|
117 | - [ |
|
118 | - 'description' => $type->description(), |
|
119 | - 'fields' => $outputFields, |
|
120 | - ] |
|
121 | - ); |
|
122 | - } |
|
123 | - if (is_callable([$type, 'registerMutations'])) { |
|
124 | - $type->registerMutations($inputFields); |
|
125 | - } |
|
126 | - } |
|
93 | + /** |
|
94 | + * @param TypeInterface $type |
|
95 | + * @since $VID:$ |
|
96 | + */ |
|
97 | + public function registerType(TypeInterface $type) |
|
98 | + { |
|
99 | + $outputFields = []; |
|
100 | + $inputFields = []; |
|
101 | + foreach ($type->fields() as $field) { |
|
102 | + $fieldName = $field->name(); |
|
103 | + $config = $field->toArray(); |
|
104 | + if ($field->useForInput()) { |
|
105 | + $inputFields[$fieldName] = $config; |
|
106 | + } |
|
107 | + if ($field->useForOutput()) { |
|
108 | + $config['resolve'] = [$type, 'resolveField']; |
|
109 | + $outputFields[$fieldName] = $config; |
|
110 | + } |
|
111 | + } |
|
112 | + $typeName = $type->name(); |
|
113 | + if (! empty($outputFields)) { |
|
114 | + // Register the object type. |
|
115 | + register_graphql_object_type( |
|
116 | + $typeName, |
|
117 | + [ |
|
118 | + 'description' => $type->description(), |
|
119 | + 'fields' => $outputFields, |
|
120 | + ] |
|
121 | + ); |
|
122 | + } |
|
123 | + if (is_callable([$type, 'registerMutations'])) { |
|
124 | + $type->registerMutations($inputFields); |
|
125 | + } |
|
126 | + } |
|
127 | 127 | } |