@@ -25,215 +25,215 @@ |
||
25 | 25 | class Price extends TypeBase |
26 | 26 | { |
27 | 27 | |
28 | - /** |
|
29 | - * Price constructor. |
|
30 | - * |
|
31 | - * @param EEM_Price $price_model |
|
32 | - */ |
|
33 | - public function __construct(EEM_Price $price_model) |
|
34 | - { |
|
35 | - $this->model = $price_model; |
|
36 | - $this->setName($this->namespace . 'Price'); |
|
37 | - $this->setDescription(__('A price.', 'event_espresso')); |
|
38 | - $this->setIsCustomPostType(false); |
|
39 | - parent::__construct(); |
|
40 | - } |
|
28 | + /** |
|
29 | + * Price constructor. |
|
30 | + * |
|
31 | + * @param EEM_Price $price_model |
|
32 | + */ |
|
33 | + public function __construct(EEM_Price $price_model) |
|
34 | + { |
|
35 | + $this->model = $price_model; |
|
36 | + $this->setName($this->namespace . 'Price'); |
|
37 | + $this->setDescription(__('A price.', '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' => 'ID'], |
|
53 | - null, |
|
54 | - esc_html__('The globally unique ID for the object.', 'event_espresso') |
|
55 | - ), |
|
56 | - new GraphQLOutputField( |
|
57 | - 'dbId', |
|
58 | - ['non_null' => 'Int'], |
|
59 | - 'ID', |
|
60 | - esc_html__('Price ID', 'event_espresso') |
|
61 | - ), |
|
62 | - new GraphQLField( |
|
63 | - 'amount', |
|
64 | - 'Float', |
|
65 | - 'amount', |
|
66 | - esc_html__('Price Amount', 'event_espresso') |
|
67 | - ), |
|
68 | - new GraphQLOutputField( |
|
69 | - 'cacheId', |
|
70 | - ['non_null' => 'String'], |
|
71 | - null, |
|
72 | - esc_html__('The cache ID of the object.', 'event_espresso') |
|
73 | - ), |
|
74 | - new GraphQLField( |
|
75 | - 'description', |
|
76 | - 'String', |
|
77 | - 'desc', |
|
78 | - esc_html__('Price description', 'event_espresso') |
|
79 | - ), |
|
80 | - new GraphQLOutputField( |
|
81 | - 'isBasePrice', |
|
82 | - 'Boolean', |
|
83 | - 'is_base_price', |
|
84 | - esc_html__('Flag indicating price is a base price type.', 'event_espresso') |
|
85 | - ), |
|
86 | - new GraphQLField( |
|
87 | - 'isDefault', |
|
88 | - 'Boolean', |
|
89 | - 'is_default', |
|
90 | - esc_html__('Flag indicating price is the default one.', 'event_espresso') |
|
91 | - ), |
|
92 | - new GraphQLOutputField( |
|
93 | - 'isDiscount', |
|
94 | - 'Boolean', |
|
95 | - 'is_discount', |
|
96 | - esc_html__('Flag indicating price is a discount.', 'event_espresso') |
|
97 | - ), |
|
98 | - new GraphQLOutputField( |
|
99 | - 'isPercent', |
|
100 | - 'Boolean', |
|
101 | - 'is_percent', |
|
102 | - esc_html__('Flag indicating price is a percentage.', 'event_espresso') |
|
103 | - ), |
|
104 | - new GraphQLOutputField( |
|
105 | - 'isTax', |
|
106 | - 'Boolean', |
|
107 | - 'is_tax', |
|
108 | - esc_html__('Flag indicating price is a tax.', 'event_espresso') |
|
109 | - ), |
|
110 | - new GraphQLField( |
|
111 | - 'isTrashed', |
|
112 | - 'Boolean', |
|
113 | - 'deleted', |
|
114 | - esc_html__('Flag indicating price has been trashed.', 'event_espresso') |
|
115 | - ), |
|
116 | - new GraphQLField( |
|
117 | - 'name', |
|
118 | - 'String', |
|
119 | - 'name', |
|
120 | - esc_html__('Price Name', 'event_espresso') |
|
121 | - ), |
|
122 | - new GraphQLField( |
|
123 | - 'order', |
|
124 | - 'Int', |
|
125 | - 'order', |
|
126 | - esc_html__('Order of Application of Price.', 'event_espresso') |
|
127 | - ), |
|
128 | - new GraphQLField( |
|
129 | - 'overrides', |
|
130 | - 'Int', |
|
131 | - 'overrides', |
|
132 | - esc_html__('Price ID for a global Price that will be overridden by this Price.', 'event_espresso') |
|
133 | - ), |
|
134 | - new GraphQLOutputField( |
|
135 | - 'parent', |
|
136 | - $this->name(), |
|
137 | - null, |
|
138 | - esc_html__('The parent price of the current price', 'event_espresso') |
|
139 | - ), |
|
140 | - new GraphQLInputField( |
|
141 | - 'parent', |
|
142 | - 'ID', |
|
143 | - null, |
|
144 | - esc_html__('The parent price ID', 'event_espresso') |
|
145 | - ), |
|
146 | - new GraphQLOutputField( |
|
147 | - 'priceType', |
|
148 | - $this->namespace . 'PriceType', |
|
149 | - 'type_obj', |
|
150 | - esc_html__('The related price type object.', 'event_espresso') |
|
151 | - ), |
|
152 | - new GraphQLInputField( |
|
153 | - 'priceType', |
|
154 | - 'ID', |
|
155 | - null, |
|
156 | - esc_html__('The price type ID', 'event_espresso') |
|
157 | - ), |
|
158 | - new GraphQLOutputField( |
|
159 | - 'wpUser', |
|
160 | - 'User', |
|
161 | - null, |
|
162 | - esc_html__('Price Creator', 'event_espresso') |
|
163 | - ), |
|
164 | - new GraphQLInputField( |
|
165 | - 'wpUser', |
|
166 | - 'Int', |
|
167 | - null, |
|
168 | - esc_html__('Price Creator ID', 'event_espresso') |
|
169 | - ), |
|
170 | - ]; |
|
171 | - } |
|
43 | + /** |
|
44 | + * @return GraphQLFieldInterface[] |
|
45 | + * @since $VID:$ |
|
46 | + */ |
|
47 | + public function getFields() |
|
48 | + { |
|
49 | + return [ |
|
50 | + new GraphQLField( |
|
51 | + 'id', |
|
52 | + ['non_null' => 'ID'], |
|
53 | + null, |
|
54 | + esc_html__('The globally unique ID for the object.', 'event_espresso') |
|
55 | + ), |
|
56 | + new GraphQLOutputField( |
|
57 | + 'dbId', |
|
58 | + ['non_null' => 'Int'], |
|
59 | + 'ID', |
|
60 | + esc_html__('Price ID', 'event_espresso') |
|
61 | + ), |
|
62 | + new GraphQLField( |
|
63 | + 'amount', |
|
64 | + 'Float', |
|
65 | + 'amount', |
|
66 | + esc_html__('Price Amount', 'event_espresso') |
|
67 | + ), |
|
68 | + new GraphQLOutputField( |
|
69 | + 'cacheId', |
|
70 | + ['non_null' => 'String'], |
|
71 | + null, |
|
72 | + esc_html__('The cache ID of the object.', 'event_espresso') |
|
73 | + ), |
|
74 | + new GraphQLField( |
|
75 | + 'description', |
|
76 | + 'String', |
|
77 | + 'desc', |
|
78 | + esc_html__('Price description', 'event_espresso') |
|
79 | + ), |
|
80 | + new GraphQLOutputField( |
|
81 | + 'isBasePrice', |
|
82 | + 'Boolean', |
|
83 | + 'is_base_price', |
|
84 | + esc_html__('Flag indicating price is a base price type.', 'event_espresso') |
|
85 | + ), |
|
86 | + new GraphQLField( |
|
87 | + 'isDefault', |
|
88 | + 'Boolean', |
|
89 | + 'is_default', |
|
90 | + esc_html__('Flag indicating price is the default one.', 'event_espresso') |
|
91 | + ), |
|
92 | + new GraphQLOutputField( |
|
93 | + 'isDiscount', |
|
94 | + 'Boolean', |
|
95 | + 'is_discount', |
|
96 | + esc_html__('Flag indicating price is a discount.', 'event_espresso') |
|
97 | + ), |
|
98 | + new GraphQLOutputField( |
|
99 | + 'isPercent', |
|
100 | + 'Boolean', |
|
101 | + 'is_percent', |
|
102 | + esc_html__('Flag indicating price is a percentage.', 'event_espresso') |
|
103 | + ), |
|
104 | + new GraphQLOutputField( |
|
105 | + 'isTax', |
|
106 | + 'Boolean', |
|
107 | + 'is_tax', |
|
108 | + esc_html__('Flag indicating price is a tax.', 'event_espresso') |
|
109 | + ), |
|
110 | + new GraphQLField( |
|
111 | + 'isTrashed', |
|
112 | + 'Boolean', |
|
113 | + 'deleted', |
|
114 | + esc_html__('Flag indicating price has been trashed.', 'event_espresso') |
|
115 | + ), |
|
116 | + new GraphQLField( |
|
117 | + 'name', |
|
118 | + 'String', |
|
119 | + 'name', |
|
120 | + esc_html__('Price Name', 'event_espresso') |
|
121 | + ), |
|
122 | + new GraphQLField( |
|
123 | + 'order', |
|
124 | + 'Int', |
|
125 | + 'order', |
|
126 | + esc_html__('Order of Application of Price.', 'event_espresso') |
|
127 | + ), |
|
128 | + new GraphQLField( |
|
129 | + 'overrides', |
|
130 | + 'Int', |
|
131 | + 'overrides', |
|
132 | + esc_html__('Price ID for a global Price that will be overridden by this Price.', 'event_espresso') |
|
133 | + ), |
|
134 | + new GraphQLOutputField( |
|
135 | + 'parent', |
|
136 | + $this->name(), |
|
137 | + null, |
|
138 | + esc_html__('The parent price of the current price', 'event_espresso') |
|
139 | + ), |
|
140 | + new GraphQLInputField( |
|
141 | + 'parent', |
|
142 | + 'ID', |
|
143 | + null, |
|
144 | + esc_html__('The parent price ID', 'event_espresso') |
|
145 | + ), |
|
146 | + new GraphQLOutputField( |
|
147 | + 'priceType', |
|
148 | + $this->namespace . 'PriceType', |
|
149 | + 'type_obj', |
|
150 | + esc_html__('The related price type object.', 'event_espresso') |
|
151 | + ), |
|
152 | + new GraphQLInputField( |
|
153 | + 'priceType', |
|
154 | + 'ID', |
|
155 | + null, |
|
156 | + esc_html__('The price type ID', 'event_espresso') |
|
157 | + ), |
|
158 | + new GraphQLOutputField( |
|
159 | + 'wpUser', |
|
160 | + 'User', |
|
161 | + null, |
|
162 | + esc_html__('Price Creator', 'event_espresso') |
|
163 | + ), |
|
164 | + new GraphQLInputField( |
|
165 | + 'wpUser', |
|
166 | + 'Int', |
|
167 | + null, |
|
168 | + esc_html__('Price Creator ID', 'event_espresso') |
|
169 | + ), |
|
170 | + ]; |
|
171 | + } |
|
172 | 172 | |
173 | 173 | |
174 | - /** |
|
175 | - * @param array $inputFields The mutation input fields. |
|
176 | - * @throws InvalidArgumentException |
|
177 | - * @throws ReflectionException |
|
178 | - * @since $VID:$ |
|
179 | - */ |
|
180 | - public function registerMutations(array $inputFields) |
|
181 | - { |
|
182 | - // Register mutation to update an entity. |
|
183 | - register_graphql_mutation( |
|
184 | - 'update' . $this->name(), |
|
185 | - [ |
|
186 | - 'inputFields' => $inputFields, |
|
187 | - 'outputFields' => [ |
|
188 | - lcfirst($this->name()) => [ |
|
189 | - 'type' => $this->name(), |
|
190 | - 'resolve' => [$this, 'resolveFromPayload'], |
|
191 | - ], |
|
192 | - ], |
|
193 | - 'mutateAndGetPayload' => PriceUpdate::mutateAndGetPayload($this->model, $this), |
|
194 | - ] |
|
195 | - ); |
|
196 | - // Register mutation to delete an entity. |
|
197 | - register_graphql_mutation( |
|
198 | - 'delete' . $this->name(), |
|
199 | - [ |
|
200 | - 'inputFields' => [ |
|
201 | - 'id' => $inputFields['id'], |
|
202 | - 'deletePermanently' => [ |
|
203 | - 'type' => 'Boolean', |
|
204 | - 'description' => esc_html__('Whether to delete the entity permanently.', 'event_espresso'), |
|
205 | - ], |
|
206 | - ], |
|
207 | - 'outputFields' => [ |
|
208 | - lcfirst($this->name()) => [ |
|
209 | - 'type' => $this->name(), |
|
210 | - 'description' => esc_html__('The object before it was deleted', 'event_espresso'), |
|
211 | - 'resolve' => static function ($payload) { |
|
212 | - $deleted = (object) $payload['deleted']; |
|
174 | + /** |
|
175 | + * @param array $inputFields The mutation input fields. |
|
176 | + * @throws InvalidArgumentException |
|
177 | + * @throws ReflectionException |
|
178 | + * @since $VID:$ |
|
179 | + */ |
|
180 | + public function registerMutations(array $inputFields) |
|
181 | + { |
|
182 | + // Register mutation to update an entity. |
|
183 | + register_graphql_mutation( |
|
184 | + 'update' . $this->name(), |
|
185 | + [ |
|
186 | + 'inputFields' => $inputFields, |
|
187 | + 'outputFields' => [ |
|
188 | + lcfirst($this->name()) => [ |
|
189 | + 'type' => $this->name(), |
|
190 | + 'resolve' => [$this, 'resolveFromPayload'], |
|
191 | + ], |
|
192 | + ], |
|
193 | + 'mutateAndGetPayload' => PriceUpdate::mutateAndGetPayload($this->model, $this), |
|
194 | + ] |
|
195 | + ); |
|
196 | + // Register mutation to delete an entity. |
|
197 | + register_graphql_mutation( |
|
198 | + 'delete' . $this->name(), |
|
199 | + [ |
|
200 | + 'inputFields' => [ |
|
201 | + 'id' => $inputFields['id'], |
|
202 | + 'deletePermanently' => [ |
|
203 | + 'type' => 'Boolean', |
|
204 | + 'description' => esc_html__('Whether to delete the entity permanently.', 'event_espresso'), |
|
205 | + ], |
|
206 | + ], |
|
207 | + 'outputFields' => [ |
|
208 | + lcfirst($this->name()) => [ |
|
209 | + 'type' => $this->name(), |
|
210 | + 'description' => esc_html__('The object before it was deleted', 'event_espresso'), |
|
211 | + 'resolve' => static function ($payload) { |
|
212 | + $deleted = (object) $payload['deleted']; |
|
213 | 213 | |
214 | - return ! empty($deleted) ? $deleted : null; |
|
215 | - }, |
|
216 | - ], |
|
217 | - ], |
|
218 | - 'mutateAndGetPayload' => PriceDelete::mutateAndGetPayload($this->model, $this), |
|
219 | - ] |
|
220 | - ); |
|
214 | + return ! empty($deleted) ? $deleted : null; |
|
215 | + }, |
|
216 | + ], |
|
217 | + ], |
|
218 | + 'mutateAndGetPayload' => PriceDelete::mutateAndGetPayload($this->model, $this), |
|
219 | + ] |
|
220 | + ); |
|
221 | 221 | |
222 | - // remove primary key from input. |
|
223 | - unset($inputFields['id']); |
|
224 | - // Register mutation to update an entity. |
|
225 | - register_graphql_mutation( |
|
226 | - 'create' . $this->name(), |
|
227 | - [ |
|
228 | - 'inputFields' => $inputFields, |
|
229 | - 'outputFields' => [ |
|
230 | - lcfirst($this->name()) => [ |
|
231 | - 'type' => $this->name(), |
|
232 | - 'resolve' => [$this, 'resolveFromPayload'], |
|
233 | - ], |
|
234 | - ], |
|
235 | - 'mutateAndGetPayload' => PriceCreate::mutateAndGetPayload($this->model, $this), |
|
236 | - ] |
|
237 | - ); |
|
238 | - } |
|
222 | + // remove primary key from input. |
|
223 | + unset($inputFields['id']); |
|
224 | + // Register mutation to update an entity. |
|
225 | + register_graphql_mutation( |
|
226 | + 'create' . $this->name(), |
|
227 | + [ |
|
228 | + 'inputFields' => $inputFields, |
|
229 | + 'outputFields' => [ |
|
230 | + lcfirst($this->name()) => [ |
|
231 | + 'type' => $this->name(), |
|
232 | + 'resolve' => [$this, 'resolveFromPayload'], |
|
233 | + ], |
|
234 | + ], |
|
235 | + 'mutateAndGetPayload' => PriceCreate::mutateAndGetPayload($this->model, $this), |
|
236 | + ] |
|
237 | + ); |
|
238 | + } |
|
239 | 239 | } |
@@ -21,202 +21,202 @@ |
||
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($this->namespace . '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($this->namespace . '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 GraphQLOutputField( |
|
46 | - 'dbId', |
|
47 | - ['non_null' => 'Int'], |
|
48 | - 'ID', |
|
49 | - esc_html__('The event ID.', 'event_espresso') |
|
50 | - ), |
|
51 | - new GraphQLOutputField( |
|
52 | - 'cacheId', |
|
53 | - ['non_null' => 'String'], |
|
54 | - null, |
|
55 | - esc_html__('The cache ID of the object.', 'event_espresso') |
|
56 | - ), |
|
57 | - new GraphQLField( |
|
58 | - 'name', |
|
59 | - 'String', |
|
60 | - 'name', |
|
61 | - esc_html__('Event Name', 'event_espresso') |
|
62 | - ), |
|
63 | - new GraphQLField( |
|
64 | - 'description', |
|
65 | - 'String', |
|
66 | - 'description', |
|
67 | - esc_html__('Event Description', 'event_espresso') |
|
68 | - ), |
|
69 | - new GraphQLField( |
|
70 | - 'shortDescription', |
|
71 | - 'String', |
|
72 | - 'short_description', |
|
73 | - esc_html__('Event Short Description', 'event_espresso') |
|
74 | - ), |
|
75 | - new GraphQLField( |
|
76 | - 'created', |
|
77 | - 'String', |
|
78 | - 'created', |
|
79 | - esc_html__('Date/Time Event Created', 'event_espresso') |
|
80 | - ), |
|
81 | - new GraphQLOutputField( |
|
82 | - 'wpUser', |
|
83 | - 'User', |
|
84 | - null, |
|
85 | - esc_html__('Event Creator', 'event_espresso') |
|
86 | - ), |
|
87 | - new GraphQLInputField( |
|
88 | - 'wpUser', |
|
89 | - 'Int', |
|
90 | - null, |
|
91 | - esc_html__('Event Creator ID', 'event_espresso') |
|
92 | - ), |
|
93 | - new GraphQLField( |
|
94 | - 'order', |
|
95 | - 'Int', |
|
96 | - 'order', |
|
97 | - esc_html__('Event Menu Order', 'event_espresso') |
|
98 | - ), |
|
99 | - new GraphQLField( |
|
100 | - 'displayDesc', |
|
101 | - 'Boolean', |
|
102 | - 'display_description', |
|
103 | - esc_html__('Display Description Flag', 'event_espresso') |
|
104 | - ), |
|
105 | - new GraphQLField( |
|
106 | - 'displayTicketSelector', |
|
107 | - 'Boolean', |
|
108 | - 'display_ticket_selector', |
|
109 | - esc_html__('Display Ticket Selector Flag', 'event_espresso') |
|
110 | - ), |
|
111 | - new GraphQLField( |
|
112 | - 'visibleOn', |
|
113 | - 'String', |
|
114 | - 'visible_on', |
|
115 | - esc_html__('Event Visible Date', 'event_espresso') |
|
116 | - ), |
|
117 | - new GraphQLField( |
|
118 | - 'additionalLimit', |
|
119 | - 'Int', |
|
120 | - 'additional_limit', |
|
121 | - esc_html__('Limit of Additional Registrations on Same Transaction', 'event_espresso') |
|
122 | - ), |
|
123 | - new GraphQLField( |
|
124 | - 'phone', |
|
125 | - 'String', |
|
126 | - 'phone', |
|
127 | - esc_html__('Event Phone Number', 'event_espresso') |
|
128 | - ), |
|
129 | - new GraphQLField( |
|
130 | - 'memberOnly', |
|
131 | - 'Boolean', |
|
132 | - 'member_only', |
|
133 | - esc_html__('Member-Only Event Flag', 'event_espresso') |
|
134 | - ), |
|
135 | - new GraphQLField( |
|
136 | - 'allowOverflow', |
|
137 | - 'Boolean', |
|
138 | - 'allow_overflow', |
|
139 | - esc_html__('Allow Overflow on Event', 'event_espresso') |
|
140 | - ), |
|
141 | - new GraphQLField( |
|
142 | - 'timezoneString', |
|
143 | - 'String', |
|
144 | - 'timezone_string', |
|
145 | - esc_html__('Timezone (name) for Event times', 'event_espresso') |
|
146 | - ), |
|
147 | - new GraphQLField( |
|
148 | - 'externalUrl', |
|
149 | - 'String', |
|
150 | - 'external_url', |
|
151 | - esc_html__('URL of Event Page if hosted elsewhere', 'event_espresso') |
|
152 | - ), |
|
153 | - new GraphQLField( |
|
154 | - 'donations', |
|
155 | - 'Boolean', |
|
156 | - 'donations', |
|
157 | - esc_html__('Accept Donations?', 'event_espresso') |
|
158 | - ), |
|
159 | - new GraphQLField( |
|
160 | - 'isSoldOut', |
|
161 | - 'Boolean', |
|
162 | - 'is_sold_out', |
|
163 | - esc_html__( |
|
164 | - 'Flag indicating whether the tickets sold for the event, met or exceed the registration limit', |
|
165 | - 'event_espresso' |
|
166 | - ) |
|
167 | - ), |
|
168 | - new GraphQLField( |
|
169 | - 'isPostponed', |
|
170 | - 'Boolean', |
|
171 | - 'is_postponed', |
|
172 | - esc_html__('Flag indicating whether the event is marked as postponed', 'event_espresso') |
|
173 | - ), |
|
174 | - new GraphQLField( |
|
175 | - 'isCancelled', |
|
176 | - 'Boolean', |
|
177 | - 'is_cancelled', |
|
178 | - esc_html__('Flag indicating whether the event is marked as cancelled', 'event_espresso') |
|
179 | - ), |
|
180 | - new GraphQLOutputField( |
|
181 | - 'isUpcoming', |
|
182 | - 'Boolean', |
|
183 | - 'is_upcoming', |
|
184 | - esc_html__('Whether the event is upcoming', 'event_espresso') |
|
185 | - ), |
|
186 | - new GraphQLOutputField( |
|
187 | - 'isActive', |
|
188 | - 'Boolean', |
|
189 | - 'is_active', |
|
190 | - esc_html__('Flag indicating event is active', 'event_espresso') |
|
191 | - ), |
|
192 | - new GraphQLOutputField( |
|
193 | - 'isInactive', |
|
194 | - 'Boolean', |
|
195 | - 'is_inactive', |
|
196 | - esc_html__('Flag indicating event is inactive', 'event_espresso') |
|
197 | - ), |
|
198 | - new GraphQLOutputField( |
|
199 | - 'isExpired', |
|
200 | - 'Boolean', |
|
201 | - 'is_expired', |
|
202 | - esc_html__('Flag indicating event is expired or not', 'event_espresso') |
|
203 | - ), |
|
204 | - ]; |
|
205 | - } |
|
38 | + /** |
|
39 | + * @return GraphQLFieldInterface[] |
|
40 | + * @since $VID:$ |
|
41 | + */ |
|
42 | + public function getFields() |
|
43 | + { |
|
44 | + return [ |
|
45 | + new GraphQLOutputField( |
|
46 | + 'dbId', |
|
47 | + ['non_null' => 'Int'], |
|
48 | + 'ID', |
|
49 | + esc_html__('The event ID.', 'event_espresso') |
|
50 | + ), |
|
51 | + new GraphQLOutputField( |
|
52 | + 'cacheId', |
|
53 | + ['non_null' => 'String'], |
|
54 | + null, |
|
55 | + esc_html__('The cache ID of the object.', 'event_espresso') |
|
56 | + ), |
|
57 | + new GraphQLField( |
|
58 | + 'name', |
|
59 | + 'String', |
|
60 | + 'name', |
|
61 | + esc_html__('Event Name', 'event_espresso') |
|
62 | + ), |
|
63 | + new GraphQLField( |
|
64 | + 'description', |
|
65 | + 'String', |
|
66 | + 'description', |
|
67 | + esc_html__('Event Description', 'event_espresso') |
|
68 | + ), |
|
69 | + new GraphQLField( |
|
70 | + 'shortDescription', |
|
71 | + 'String', |
|
72 | + 'short_description', |
|
73 | + esc_html__('Event Short Description', 'event_espresso') |
|
74 | + ), |
|
75 | + new GraphQLField( |
|
76 | + 'created', |
|
77 | + 'String', |
|
78 | + 'created', |
|
79 | + esc_html__('Date/Time Event Created', 'event_espresso') |
|
80 | + ), |
|
81 | + new GraphQLOutputField( |
|
82 | + 'wpUser', |
|
83 | + 'User', |
|
84 | + null, |
|
85 | + esc_html__('Event Creator', 'event_espresso') |
|
86 | + ), |
|
87 | + new GraphQLInputField( |
|
88 | + 'wpUser', |
|
89 | + 'Int', |
|
90 | + null, |
|
91 | + esc_html__('Event Creator ID', 'event_espresso') |
|
92 | + ), |
|
93 | + new GraphQLField( |
|
94 | + 'order', |
|
95 | + 'Int', |
|
96 | + 'order', |
|
97 | + esc_html__('Event Menu Order', 'event_espresso') |
|
98 | + ), |
|
99 | + new GraphQLField( |
|
100 | + 'displayDesc', |
|
101 | + 'Boolean', |
|
102 | + 'display_description', |
|
103 | + esc_html__('Display Description Flag', 'event_espresso') |
|
104 | + ), |
|
105 | + new GraphQLField( |
|
106 | + 'displayTicketSelector', |
|
107 | + 'Boolean', |
|
108 | + 'display_ticket_selector', |
|
109 | + esc_html__('Display Ticket Selector Flag', 'event_espresso') |
|
110 | + ), |
|
111 | + new GraphQLField( |
|
112 | + 'visibleOn', |
|
113 | + 'String', |
|
114 | + 'visible_on', |
|
115 | + esc_html__('Event Visible Date', 'event_espresso') |
|
116 | + ), |
|
117 | + new GraphQLField( |
|
118 | + 'additionalLimit', |
|
119 | + 'Int', |
|
120 | + 'additional_limit', |
|
121 | + esc_html__('Limit of Additional Registrations on Same Transaction', 'event_espresso') |
|
122 | + ), |
|
123 | + new GraphQLField( |
|
124 | + 'phone', |
|
125 | + 'String', |
|
126 | + 'phone', |
|
127 | + esc_html__('Event Phone Number', 'event_espresso') |
|
128 | + ), |
|
129 | + new GraphQLField( |
|
130 | + 'memberOnly', |
|
131 | + 'Boolean', |
|
132 | + 'member_only', |
|
133 | + esc_html__('Member-Only Event Flag', 'event_espresso') |
|
134 | + ), |
|
135 | + new GraphQLField( |
|
136 | + 'allowOverflow', |
|
137 | + 'Boolean', |
|
138 | + 'allow_overflow', |
|
139 | + esc_html__('Allow Overflow on Event', 'event_espresso') |
|
140 | + ), |
|
141 | + new GraphQLField( |
|
142 | + 'timezoneString', |
|
143 | + 'String', |
|
144 | + 'timezone_string', |
|
145 | + esc_html__('Timezone (name) for Event times', 'event_espresso') |
|
146 | + ), |
|
147 | + new GraphQLField( |
|
148 | + 'externalUrl', |
|
149 | + 'String', |
|
150 | + 'external_url', |
|
151 | + esc_html__('URL of Event Page if hosted elsewhere', 'event_espresso') |
|
152 | + ), |
|
153 | + new GraphQLField( |
|
154 | + 'donations', |
|
155 | + 'Boolean', |
|
156 | + 'donations', |
|
157 | + esc_html__('Accept Donations?', 'event_espresso') |
|
158 | + ), |
|
159 | + new GraphQLField( |
|
160 | + 'isSoldOut', |
|
161 | + 'Boolean', |
|
162 | + 'is_sold_out', |
|
163 | + esc_html__( |
|
164 | + 'Flag indicating whether the tickets sold for the event, met or exceed the registration limit', |
|
165 | + 'event_espresso' |
|
166 | + ) |
|
167 | + ), |
|
168 | + new GraphQLField( |
|
169 | + 'isPostponed', |
|
170 | + 'Boolean', |
|
171 | + 'is_postponed', |
|
172 | + esc_html__('Flag indicating whether the event is marked as postponed', 'event_espresso') |
|
173 | + ), |
|
174 | + new GraphQLField( |
|
175 | + 'isCancelled', |
|
176 | + 'Boolean', |
|
177 | + 'is_cancelled', |
|
178 | + esc_html__('Flag indicating whether the event is marked as cancelled', 'event_espresso') |
|
179 | + ), |
|
180 | + new GraphQLOutputField( |
|
181 | + 'isUpcoming', |
|
182 | + 'Boolean', |
|
183 | + 'is_upcoming', |
|
184 | + esc_html__('Whether the event is upcoming', 'event_espresso') |
|
185 | + ), |
|
186 | + new GraphQLOutputField( |
|
187 | + 'isActive', |
|
188 | + 'Boolean', |
|
189 | + 'is_active', |
|
190 | + esc_html__('Flag indicating event is active', 'event_espresso') |
|
191 | + ), |
|
192 | + new GraphQLOutputField( |
|
193 | + 'isInactive', |
|
194 | + 'Boolean', |
|
195 | + 'is_inactive', |
|
196 | + esc_html__('Flag indicating event is inactive', 'event_espresso') |
|
197 | + ), |
|
198 | + new GraphQLOutputField( |
|
199 | + 'isExpired', |
|
200 | + 'Boolean', |
|
201 | + 'is_expired', |
|
202 | + esc_html__('Flag indicating event is expired or not', 'event_espresso') |
|
203 | + ), |
|
204 | + ]; |
|
205 | + } |
|
206 | 206 | |
207 | 207 | |
208 | - /** |
|
209 | - * Extends the existing WP GraphQL mutations. |
|
210 | - * |
|
211 | - * @since $VID:$ |
|
212 | - */ |
|
213 | - public function extendMutations() |
|
214 | - { |
|
215 | - add_action( |
|
216 | - 'graphql_post_object_mutation_update_additional_data', |
|
217 | - EventUpdate::mutateFields($this->model, $this), |
|
218 | - 10, |
|
219 | - 6 |
|
220 | - ); |
|
221 | - } |
|
208 | + /** |
|
209 | + * Extends the existing WP GraphQL mutations. |
|
210 | + * |
|
211 | + * @since $VID:$ |
|
212 | + */ |
|
213 | + public function extendMutations() |
|
214 | + { |
|
215 | + add_action( |
|
216 | + 'graphql_post_object_mutation_update_additional_data', |
|
217 | + EventUpdate::mutateFields($this->model, $this), |
|
218 | + 10, |
|
219 | + 6 |
|
220 | + ); |
|
221 | + } |
|
222 | 222 | } |
@@ -21,194 +21,194 @@ |
||
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($this->namespace . '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($this->namespace . '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 GraphQLOutputField( |
|
46 | - 'dbId', |
|
47 | - ['non_null' => 'Int'], |
|
48 | - 'ID', |
|
49 | - esc_html__('The venue ID.', 'event_espresso') |
|
50 | - ), |
|
51 | - new GraphQLOutputField( |
|
52 | - 'cacheId', |
|
53 | - ['non_null' => 'String'], |
|
54 | - null, |
|
55 | - esc_html__('The cache ID of the object.', 'event_espresso') |
|
56 | - ), |
|
57 | - new GraphQLField( |
|
58 | - 'name', |
|
59 | - 'String', |
|
60 | - 'name', |
|
61 | - esc_html__('Venue Name', 'event_espresso') |
|
62 | - ), |
|
63 | - new GraphQLField( |
|
64 | - 'description', |
|
65 | - 'String', |
|
66 | - 'description', |
|
67 | - esc_html__('Venue Description', 'event_espresso') |
|
68 | - ), |
|
69 | - new GraphQLField( |
|
70 | - 'shortDescription', |
|
71 | - 'String', |
|
72 | - 'excerpt', |
|
73 | - esc_html__('Short Description of Venue', 'event_espresso') |
|
74 | - ), |
|
75 | - new GraphQLField( |
|
76 | - 'identifier', |
|
77 | - 'String', |
|
78 | - 'identifier', |
|
79 | - esc_html__('Venue Identifier', 'event_espresso') |
|
80 | - ), |
|
81 | - new GraphQLField( |
|
82 | - 'created', |
|
83 | - 'String', |
|
84 | - 'created', |
|
85 | - esc_html__('Date Venue Created', 'event_espresso') |
|
86 | - ), |
|
87 | - new GraphQLField( |
|
88 | - 'order', |
|
89 | - 'Int', |
|
90 | - 'order', |
|
91 | - esc_html__('Venue order', 'event_espresso') |
|
92 | - ), |
|
93 | - new GraphQLOutputField( |
|
94 | - 'wpUser', |
|
95 | - 'User', |
|
96 | - null, |
|
97 | - esc_html__('Venue Creator', 'event_espresso') |
|
98 | - ), |
|
99 | - new GraphQLInputField( |
|
100 | - 'wpUser', |
|
101 | - 'Int', |
|
102 | - null, |
|
103 | - esc_html__('Venue Creator ID', 'event_espresso') |
|
104 | - ), |
|
105 | - new GraphQLField( |
|
106 | - 'address', |
|
107 | - 'String', |
|
108 | - 'address', |
|
109 | - esc_html__('Venue Address line 1', 'event_espresso') |
|
110 | - ), |
|
111 | - new GraphQLField( |
|
112 | - 'address2', |
|
113 | - 'String', |
|
114 | - 'address2', |
|
115 | - esc_html__('Venue Address line 2', 'event_espresso') |
|
116 | - ), |
|
117 | - new GraphQLField( |
|
118 | - 'city', |
|
119 | - 'String', |
|
120 | - 'city', |
|
121 | - esc_html__('Venue City', 'event_espresso') |
|
122 | - ), |
|
123 | - new GraphQLOutputField( |
|
124 | - 'state', |
|
125 | - $this->namespace . 'State', |
|
126 | - null, |
|
127 | - esc_html__('Venue state', 'event_espresso') |
|
128 | - ), |
|
129 | - new GraphQLInputField( |
|
130 | - 'state', |
|
131 | - 'Int', |
|
132 | - null, |
|
133 | - esc_html__('State ID', 'event_espresso') |
|
134 | - ), |
|
135 | - new GraphQLOutputField( |
|
136 | - 'country', |
|
137 | - $this->namespace . 'Country', |
|
138 | - null, |
|
139 | - esc_html__('Venue country', 'event_espresso') |
|
140 | - ), |
|
141 | - new GraphQLInputField( |
|
142 | - 'country', |
|
143 | - 'String', |
|
144 | - null, |
|
145 | - esc_html__('Country ISO Code', 'event_espresso') |
|
146 | - ), |
|
147 | - new GraphQLField( |
|
148 | - 'zip', |
|
149 | - 'String', |
|
150 | - 'zip', |
|
151 | - esc_html__('Venue Zip/Postal Code', 'event_espresso') |
|
152 | - ), |
|
153 | - new GraphQLField( |
|
154 | - 'capacity', |
|
155 | - 'Int', |
|
156 | - 'capacity', |
|
157 | - esc_html__('Venue Capacity', 'event_espresso'), |
|
158 | - [$this, 'parseInfiniteValue'] |
|
159 | - ), |
|
160 | - new GraphQLField( |
|
161 | - 'phone', |
|
162 | - 'String', |
|
163 | - 'phone', |
|
164 | - esc_html__('Venue Phone', 'event_espresso') |
|
165 | - ), |
|
166 | - new GraphQLField( |
|
167 | - 'virtualPhone', |
|
168 | - 'String', |
|
169 | - 'virtual_phone', |
|
170 | - esc_html__('Call in Number', 'event_espresso') |
|
171 | - ), |
|
172 | - new GraphQLField( |
|
173 | - 'url', |
|
174 | - 'String', |
|
175 | - 'venue_url', |
|
176 | - esc_html__('Venue Website', 'event_espresso') |
|
177 | - ), |
|
178 | - new GraphQLField( |
|
179 | - 'virtualUrl', |
|
180 | - 'String', |
|
181 | - 'virtual_url', |
|
182 | - esc_html__('Virtual URL', 'event_espresso') |
|
183 | - ), |
|
184 | - new GraphQLField( |
|
185 | - 'googleMapLink', |
|
186 | - 'String', |
|
187 | - 'google_map_link', |
|
188 | - esc_html__('Google Map Link', 'event_espresso') |
|
189 | - ), |
|
190 | - new GraphQLField( |
|
191 | - 'enableForGmap', |
|
192 | - 'String', |
|
193 | - 'enable_for_gmap', |
|
194 | - esc_html__('Show Google Map?', 'event_espresso') |
|
195 | - ), |
|
196 | - ]; |
|
197 | - } |
|
38 | + /** |
|
39 | + * @return GraphQLFieldInterface[] |
|
40 | + * @since $VID:$ |
|
41 | + */ |
|
42 | + public function getFields() |
|
43 | + { |
|
44 | + return [ |
|
45 | + new GraphQLOutputField( |
|
46 | + 'dbId', |
|
47 | + ['non_null' => 'Int'], |
|
48 | + 'ID', |
|
49 | + esc_html__('The venue ID.', 'event_espresso') |
|
50 | + ), |
|
51 | + new GraphQLOutputField( |
|
52 | + 'cacheId', |
|
53 | + ['non_null' => 'String'], |
|
54 | + null, |
|
55 | + esc_html__('The cache ID of the object.', 'event_espresso') |
|
56 | + ), |
|
57 | + new GraphQLField( |
|
58 | + 'name', |
|
59 | + 'String', |
|
60 | + 'name', |
|
61 | + esc_html__('Venue Name', 'event_espresso') |
|
62 | + ), |
|
63 | + new GraphQLField( |
|
64 | + 'description', |
|
65 | + 'String', |
|
66 | + 'description', |
|
67 | + esc_html__('Venue Description', 'event_espresso') |
|
68 | + ), |
|
69 | + new GraphQLField( |
|
70 | + 'shortDescription', |
|
71 | + 'String', |
|
72 | + 'excerpt', |
|
73 | + esc_html__('Short Description of Venue', 'event_espresso') |
|
74 | + ), |
|
75 | + new GraphQLField( |
|
76 | + 'identifier', |
|
77 | + 'String', |
|
78 | + 'identifier', |
|
79 | + esc_html__('Venue Identifier', 'event_espresso') |
|
80 | + ), |
|
81 | + new GraphQLField( |
|
82 | + 'created', |
|
83 | + 'String', |
|
84 | + 'created', |
|
85 | + esc_html__('Date Venue Created', 'event_espresso') |
|
86 | + ), |
|
87 | + new GraphQLField( |
|
88 | + 'order', |
|
89 | + 'Int', |
|
90 | + 'order', |
|
91 | + esc_html__('Venue order', 'event_espresso') |
|
92 | + ), |
|
93 | + new GraphQLOutputField( |
|
94 | + 'wpUser', |
|
95 | + 'User', |
|
96 | + null, |
|
97 | + esc_html__('Venue Creator', 'event_espresso') |
|
98 | + ), |
|
99 | + new GraphQLInputField( |
|
100 | + 'wpUser', |
|
101 | + 'Int', |
|
102 | + null, |
|
103 | + esc_html__('Venue Creator ID', 'event_espresso') |
|
104 | + ), |
|
105 | + new GraphQLField( |
|
106 | + 'address', |
|
107 | + 'String', |
|
108 | + 'address', |
|
109 | + esc_html__('Venue Address line 1', 'event_espresso') |
|
110 | + ), |
|
111 | + new GraphQLField( |
|
112 | + 'address2', |
|
113 | + 'String', |
|
114 | + 'address2', |
|
115 | + esc_html__('Venue Address line 2', 'event_espresso') |
|
116 | + ), |
|
117 | + new GraphQLField( |
|
118 | + 'city', |
|
119 | + 'String', |
|
120 | + 'city', |
|
121 | + esc_html__('Venue City', 'event_espresso') |
|
122 | + ), |
|
123 | + new GraphQLOutputField( |
|
124 | + 'state', |
|
125 | + $this->namespace . 'State', |
|
126 | + null, |
|
127 | + esc_html__('Venue state', 'event_espresso') |
|
128 | + ), |
|
129 | + new GraphQLInputField( |
|
130 | + 'state', |
|
131 | + 'Int', |
|
132 | + null, |
|
133 | + esc_html__('State ID', 'event_espresso') |
|
134 | + ), |
|
135 | + new GraphQLOutputField( |
|
136 | + 'country', |
|
137 | + $this->namespace . 'Country', |
|
138 | + null, |
|
139 | + esc_html__('Venue country', 'event_espresso') |
|
140 | + ), |
|
141 | + new GraphQLInputField( |
|
142 | + 'country', |
|
143 | + 'String', |
|
144 | + null, |
|
145 | + esc_html__('Country ISO Code', 'event_espresso') |
|
146 | + ), |
|
147 | + new GraphQLField( |
|
148 | + 'zip', |
|
149 | + 'String', |
|
150 | + 'zip', |
|
151 | + esc_html__('Venue Zip/Postal Code', 'event_espresso') |
|
152 | + ), |
|
153 | + new GraphQLField( |
|
154 | + 'capacity', |
|
155 | + 'Int', |
|
156 | + 'capacity', |
|
157 | + esc_html__('Venue Capacity', 'event_espresso'), |
|
158 | + [$this, 'parseInfiniteValue'] |
|
159 | + ), |
|
160 | + new GraphQLField( |
|
161 | + 'phone', |
|
162 | + 'String', |
|
163 | + 'phone', |
|
164 | + esc_html__('Venue Phone', 'event_espresso') |
|
165 | + ), |
|
166 | + new GraphQLField( |
|
167 | + 'virtualPhone', |
|
168 | + 'String', |
|
169 | + 'virtual_phone', |
|
170 | + esc_html__('Call in Number', 'event_espresso') |
|
171 | + ), |
|
172 | + new GraphQLField( |
|
173 | + 'url', |
|
174 | + 'String', |
|
175 | + 'venue_url', |
|
176 | + esc_html__('Venue Website', 'event_espresso') |
|
177 | + ), |
|
178 | + new GraphQLField( |
|
179 | + 'virtualUrl', |
|
180 | + 'String', |
|
181 | + 'virtual_url', |
|
182 | + esc_html__('Virtual URL', 'event_espresso') |
|
183 | + ), |
|
184 | + new GraphQLField( |
|
185 | + 'googleMapLink', |
|
186 | + 'String', |
|
187 | + 'google_map_link', |
|
188 | + esc_html__('Google Map Link', 'event_espresso') |
|
189 | + ), |
|
190 | + new GraphQLField( |
|
191 | + 'enableForGmap', |
|
192 | + 'String', |
|
193 | + 'enable_for_gmap', |
|
194 | + esc_html__('Show Google Map?', 'event_espresso') |
|
195 | + ), |
|
196 | + ]; |
|
197 | + } |
|
198 | 198 | |
199 | 199 | |
200 | - /** |
|
201 | - * Extends the existing WP GraphQL mutations. |
|
202 | - * |
|
203 | - * @since $VID:$ |
|
204 | - */ |
|
205 | - public function extendMutations() |
|
206 | - { |
|
207 | - add_action( |
|
208 | - 'graphql_post_object_mutation_update_additional_data', |
|
209 | - VenueUpdate::mutateFields($this->model, $this), |
|
210 | - 10, |
|
211 | - 6 |
|
212 | - ); |
|
213 | - } |
|
200 | + /** |
|
201 | + * Extends the existing WP GraphQL mutations. |
|
202 | + * |
|
203 | + * @since $VID:$ |
|
204 | + */ |
|
205 | + public function extendMutations() |
|
206 | + { |
|
207 | + add_action( |
|
208 | + 'graphql_post_object_mutation_update_additional_data', |
|
209 | + VenueUpdate::mutateFields($this->model, $this), |
|
210 | + 10, |
|
211 | + 6 |
|
212 | + ); |
|
213 | + } |
|
214 | 214 | } |
@@ -13,59 +13,59 @@ |
||
13 | 13 | class PriceMutation |
14 | 14 | { |
15 | 15 | |
16 | - /** |
|
17 | - * Maps the GraphQL input to a format that the model functions can use |
|
18 | - * |
|
19 | - * @param array $input Data coming from the GraphQL mutation query input |
|
20 | - * @return array |
|
21 | - */ |
|
22 | - public static function prepareFields(array $input) |
|
23 | - { |
|
24 | - $args = []; |
|
16 | + /** |
|
17 | + * Maps the GraphQL input to a format that the model functions can use |
|
18 | + * |
|
19 | + * @param array $input Data coming from the GraphQL mutation query input |
|
20 | + * @return array |
|
21 | + */ |
|
22 | + public static function prepareFields(array $input) |
|
23 | + { |
|
24 | + $args = []; |
|
25 | 25 | |
26 | - if (! empty($input['amount'])) { |
|
27 | - $args['PRC_amount'] = (float) $input['amount']; |
|
28 | - } |
|
26 | + if (! empty($input['amount'])) { |
|
27 | + $args['PRC_amount'] = (float) $input['amount']; |
|
28 | + } |
|
29 | 29 | |
30 | - if (! empty($input['description'])) { |
|
31 | - $args['PRC_desc'] = sanitize_text_field($input['description']); |
|
32 | - } |
|
30 | + if (! empty($input['description'])) { |
|
31 | + $args['PRC_desc'] = sanitize_text_field($input['description']); |
|
32 | + } |
|
33 | 33 | |
34 | - if (array_key_exists('isDefault', $input)) { |
|
35 | - $args['PRC_is_default'] = (bool) $input['isDefault']; |
|
36 | - } |
|
34 | + if (array_key_exists('isDefault', $input)) { |
|
35 | + $args['PRC_is_default'] = (bool) $input['isDefault']; |
|
36 | + } |
|
37 | 37 | |
38 | - if (array_key_exists('isTrashed', $input)) { |
|
39 | - $args['PRC_deleted'] = (bool) $input['isTrashed']; |
|
40 | - } |
|
38 | + if (array_key_exists('isTrashed', $input)) { |
|
39 | + $args['PRC_deleted'] = (bool) $input['isTrashed']; |
|
40 | + } |
|
41 | 41 | |
42 | - if (! empty($input['name'])) { |
|
43 | - $args['PRC_name'] = sanitize_text_field($input['name']); |
|
44 | - } |
|
42 | + if (! empty($input['name'])) { |
|
43 | + $args['PRC_name'] = sanitize_text_field($input['name']); |
|
44 | + } |
|
45 | 45 | |
46 | - if (! empty($input['order'])) { |
|
47 | - $args['PRC_order'] = (int) $input['order']; |
|
48 | - } |
|
46 | + if (! empty($input['order'])) { |
|
47 | + $args['PRC_order'] = (int) $input['order']; |
|
48 | + } |
|
49 | 49 | |
50 | - if (! empty($input['overrides'])) { |
|
51 | - $args['PRC_overrides'] = (int) $input['overrides']; |
|
52 | - } |
|
50 | + if (! empty($input['overrides'])) { |
|
51 | + $args['PRC_overrides'] = (int) $input['overrides']; |
|
52 | + } |
|
53 | 53 | |
54 | - if (! empty($input['parent'])) { |
|
55 | - $parts = Relay::fromGlobalId(sanitize_text_field($input['parent'])); |
|
56 | - $args['PRC_parent'] = ! empty($parts['id']) ? absint($parts['id']) : 0; |
|
57 | - } |
|
54 | + if (! empty($input['parent'])) { |
|
55 | + $parts = Relay::fromGlobalId(sanitize_text_field($input['parent'])); |
|
56 | + $args['PRC_parent'] = ! empty($parts['id']) ? absint($parts['id']) : 0; |
|
57 | + } |
|
58 | 58 | |
59 | - if (! empty($input['priceType'])) { |
|
60 | - $parts = Relay::fromGlobalId(sanitize_text_field($input['priceType'])); |
|
61 | - $args['PRT_ID'] = ! empty($parts['id']) ? absint($parts['id']) : 0; |
|
62 | - } |
|
59 | + if (! empty($input['priceType'])) { |
|
60 | + $parts = Relay::fromGlobalId(sanitize_text_field($input['priceType'])); |
|
61 | + $args['PRT_ID'] = ! empty($parts['id']) ? absint($parts['id']) : 0; |
|
62 | + } |
|
63 | 63 | |
64 | - if (! empty($input['wpUser'])) { |
|
65 | - $parts = Relay::fromGlobalId(sanitize_text_field($input['wpUser'])); |
|
66 | - $args['PRC_wp_user'] = (! empty($parts['id']) && is_int($parts['id'])) ? $parts['id'] : null; |
|
67 | - } |
|
64 | + if (! empty($input['wpUser'])) { |
|
65 | + $parts = Relay::fromGlobalId(sanitize_text_field($input['wpUser'])); |
|
66 | + $args['PRC_wp_user'] = (! empty($parts['id']) && is_int($parts['id'])) ? $parts['id'] : null; |
|
67 | + } |
|
68 | 68 | |
69 | - return $args; |
|
70 | - } |
|
69 | + return $args; |
|
70 | + } |
|
71 | 71 | } |
@@ -23,11 +23,11 @@ discard block |
||
23 | 23 | { |
24 | 24 | $args = []; |
25 | 25 | |
26 | - if (! empty($input['amount'])) { |
|
26 | + if ( ! empty($input['amount'])) { |
|
27 | 27 | $args['PRC_amount'] = (float) $input['amount']; |
28 | 28 | } |
29 | 29 | |
30 | - if (! empty($input['description'])) { |
|
30 | + if ( ! empty($input['description'])) { |
|
31 | 31 | $args['PRC_desc'] = sanitize_text_field($input['description']); |
32 | 32 | } |
33 | 33 | |
@@ -39,31 +39,31 @@ discard block |
||
39 | 39 | $args['PRC_deleted'] = (bool) $input['isTrashed']; |
40 | 40 | } |
41 | 41 | |
42 | - if (! empty($input['name'])) { |
|
42 | + if ( ! empty($input['name'])) { |
|
43 | 43 | $args['PRC_name'] = sanitize_text_field($input['name']); |
44 | 44 | } |
45 | 45 | |
46 | - if (! empty($input['order'])) { |
|
46 | + if ( ! empty($input['order'])) { |
|
47 | 47 | $args['PRC_order'] = (int) $input['order']; |
48 | 48 | } |
49 | 49 | |
50 | - if (! empty($input['overrides'])) { |
|
50 | + if ( ! empty($input['overrides'])) { |
|
51 | 51 | $args['PRC_overrides'] = (int) $input['overrides']; |
52 | 52 | } |
53 | 53 | |
54 | - if (! empty($input['parent'])) { |
|
54 | + if ( ! empty($input['parent'])) { |
|
55 | 55 | $parts = Relay::fromGlobalId(sanitize_text_field($input['parent'])); |
56 | 56 | $args['PRC_parent'] = ! empty($parts['id']) ? absint($parts['id']) : 0; |
57 | 57 | } |
58 | 58 | |
59 | - if (! empty($input['priceType'])) { |
|
59 | + if ( ! empty($input['priceType'])) { |
|
60 | 60 | $parts = Relay::fromGlobalId(sanitize_text_field($input['priceType'])); |
61 | 61 | $args['PRT_ID'] = ! empty($parts['id']) ? absint($parts['id']) : 0; |
62 | 62 | } |
63 | 63 | |
64 | - if (! empty($input['wpUser'])) { |
|
64 | + if ( ! empty($input['wpUser'])) { |
|
65 | 65 | $parts = Relay::fromGlobalId(sanitize_text_field($input['wpUser'])); |
66 | - $args['PRC_wp_user'] = (! empty($parts['id']) && is_int($parts['id'])) ? $parts['id'] : null; |
|
66 | + $args['PRC_wp_user'] = ( ! empty($parts['id']) && is_int($parts['id'])) ? $parts['id'] : null; |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | return $args; |
@@ -14,78 +14,78 @@ |
||
14 | 14 | class EventMutation |
15 | 15 | { |
16 | 16 | |
17 | - /** |
|
18 | - * Maps the GraphQL input to a format that the model functions can use |
|
19 | - * |
|
20 | - * @param array $input Data coming from the GraphQL mutation query input |
|
21 | - * @param string $mutation_name Name of the mutation being performed |
|
22 | - * @return array |
|
23 | - * @throws Exception |
|
24 | - */ |
|
25 | - public static function prepareFields(array $input, $mutation_name) |
|
26 | - { |
|
27 | - $args = []; |
|
28 | - |
|
29 | - if (! empty($input['additionalLimit'])) { |
|
30 | - $args['EVT_additional_limit'] = absint($input['additionalLimit']); |
|
31 | - } |
|
32 | - |
|
33 | - if (array_key_exists('allowOverflow', $input)) { |
|
34 | - $args['EVT_allow_overflow'] = (bool) ($input['allowOverflow']); |
|
35 | - } |
|
36 | - |
|
37 | - if (! empty($input['description'])) { |
|
38 | - $args['EVT_desc'] = sanitize_post_field('post_content', $input['description'], null, $context = 'db'); |
|
39 | - } |
|
40 | - |
|
41 | - if (array_key_exists('displayDesc', $input)) { |
|
42 | - $args['EVT_display_desc'] = (bool) ($input['displayDesc']); |
|
43 | - } |
|
44 | - |
|
45 | - if (array_key_exists('displayTicketSelector', $input)) { |
|
46 | - $args['EVT_display_ticket_selector'] = (bool) ($input['displayTicketSelector']); |
|
47 | - } |
|
48 | - |
|
49 | - if (array_key_exists('donations', $input)) { |
|
50 | - $args['EVT_donations'] = (bool) ($input['donations']); |
|
51 | - } |
|
52 | - |
|
53 | - if (! empty($input['externalUrl'])) { |
|
54 | - $args['EVT_external_URL'] = sanitize_text_field($input['externalUrl']); |
|
55 | - } |
|
56 | - |
|
57 | - if (array_key_exists('memberOnly', $input)) { |
|
58 | - $args['EVT_member_only'] = (bool) ($input['memberOnly']); |
|
59 | - } |
|
60 | - |
|
61 | - if (! empty($input['name'])) { |
|
62 | - $args['EVT_name'] = sanitize_text_field($input['name']); |
|
63 | - } |
|
64 | - |
|
65 | - if (! empty($input['order'])) { |
|
66 | - $args['EVT_order'] = absint($input['order']); |
|
67 | - } |
|
68 | - |
|
69 | - if (! empty($input['phone'])) { |
|
70 | - $args['EVT_phone'] = sanitize_text_field($input['phone']); |
|
71 | - } |
|
72 | - |
|
73 | - if (! empty($input['shortDescription'])) { |
|
74 | - $args['EVT_short_desc'] = sanitize_post_field('post_excerpt', $input['shortDescription'], null, $context = 'db'); |
|
75 | - } |
|
76 | - |
|
77 | - if (! empty($input['timezoneString'])) { |
|
78 | - $args['EVT_timezone_string'] = sanitize_text_field($input['timezoneString']); |
|
79 | - } |
|
80 | - |
|
81 | - if (! empty($input['visibleOn'])) { |
|
82 | - $args['EVT_visible_on'] = new DateTime(sanitize_text_field($input['visibleOn'])); |
|
83 | - } |
|
84 | - |
|
85 | - if (! empty($input['wpUser'])) { |
|
86 | - $args['EVT_wp_user'] = absint($input['wpUser']); |
|
87 | - } |
|
88 | - |
|
89 | - return $args; |
|
90 | - } |
|
17 | + /** |
|
18 | + * Maps the GraphQL input to a format that the model functions can use |
|
19 | + * |
|
20 | + * @param array $input Data coming from the GraphQL mutation query input |
|
21 | + * @param string $mutation_name Name of the mutation being performed |
|
22 | + * @return array |
|
23 | + * @throws Exception |
|
24 | + */ |
|
25 | + public static function prepareFields(array $input, $mutation_name) |
|
26 | + { |
|
27 | + $args = []; |
|
28 | + |
|
29 | + if (! empty($input['additionalLimit'])) { |
|
30 | + $args['EVT_additional_limit'] = absint($input['additionalLimit']); |
|
31 | + } |
|
32 | + |
|
33 | + if (array_key_exists('allowOverflow', $input)) { |
|
34 | + $args['EVT_allow_overflow'] = (bool) ($input['allowOverflow']); |
|
35 | + } |
|
36 | + |
|
37 | + if (! empty($input['description'])) { |
|
38 | + $args['EVT_desc'] = sanitize_post_field('post_content', $input['description'], null, $context = 'db'); |
|
39 | + } |
|
40 | + |
|
41 | + if (array_key_exists('displayDesc', $input)) { |
|
42 | + $args['EVT_display_desc'] = (bool) ($input['displayDesc']); |
|
43 | + } |
|
44 | + |
|
45 | + if (array_key_exists('displayTicketSelector', $input)) { |
|
46 | + $args['EVT_display_ticket_selector'] = (bool) ($input['displayTicketSelector']); |
|
47 | + } |
|
48 | + |
|
49 | + if (array_key_exists('donations', $input)) { |
|
50 | + $args['EVT_donations'] = (bool) ($input['donations']); |
|
51 | + } |
|
52 | + |
|
53 | + if (! empty($input['externalUrl'])) { |
|
54 | + $args['EVT_external_URL'] = sanitize_text_field($input['externalUrl']); |
|
55 | + } |
|
56 | + |
|
57 | + if (array_key_exists('memberOnly', $input)) { |
|
58 | + $args['EVT_member_only'] = (bool) ($input['memberOnly']); |
|
59 | + } |
|
60 | + |
|
61 | + if (! empty($input['name'])) { |
|
62 | + $args['EVT_name'] = sanitize_text_field($input['name']); |
|
63 | + } |
|
64 | + |
|
65 | + if (! empty($input['order'])) { |
|
66 | + $args['EVT_order'] = absint($input['order']); |
|
67 | + } |
|
68 | + |
|
69 | + if (! empty($input['phone'])) { |
|
70 | + $args['EVT_phone'] = sanitize_text_field($input['phone']); |
|
71 | + } |
|
72 | + |
|
73 | + if (! empty($input['shortDescription'])) { |
|
74 | + $args['EVT_short_desc'] = sanitize_post_field('post_excerpt', $input['shortDescription'], null, $context = 'db'); |
|
75 | + } |
|
76 | + |
|
77 | + if (! empty($input['timezoneString'])) { |
|
78 | + $args['EVT_timezone_string'] = sanitize_text_field($input['timezoneString']); |
|
79 | + } |
|
80 | + |
|
81 | + if (! empty($input['visibleOn'])) { |
|
82 | + $args['EVT_visible_on'] = new DateTime(sanitize_text_field($input['visibleOn'])); |
|
83 | + } |
|
84 | + |
|
85 | + if (! empty($input['wpUser'])) { |
|
86 | + $args['EVT_wp_user'] = absint($input['wpUser']); |
|
87 | + } |
|
88 | + |
|
89 | + return $args; |
|
90 | + } |
|
91 | 91 | } |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | { |
27 | 27 | $args = []; |
28 | 28 | |
29 | - if (! empty($input['additionalLimit'])) { |
|
29 | + if ( ! empty($input['additionalLimit'])) { |
|
30 | 30 | $args['EVT_additional_limit'] = absint($input['additionalLimit']); |
31 | 31 | } |
32 | 32 | |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | $args['EVT_allow_overflow'] = (bool) ($input['allowOverflow']); |
35 | 35 | } |
36 | 36 | |
37 | - if (! empty($input['description'])) { |
|
37 | + if ( ! empty($input['description'])) { |
|
38 | 38 | $args['EVT_desc'] = sanitize_post_field('post_content', $input['description'], null, $context = 'db'); |
39 | 39 | } |
40 | 40 | |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | $args['EVT_donations'] = (bool) ($input['donations']); |
51 | 51 | } |
52 | 52 | |
53 | - if (! empty($input['externalUrl'])) { |
|
53 | + if ( ! empty($input['externalUrl'])) { |
|
54 | 54 | $args['EVT_external_URL'] = sanitize_text_field($input['externalUrl']); |
55 | 55 | } |
56 | 56 | |
@@ -58,31 +58,31 @@ discard block |
||
58 | 58 | $args['EVT_member_only'] = (bool) ($input['memberOnly']); |
59 | 59 | } |
60 | 60 | |
61 | - if (! empty($input['name'])) { |
|
61 | + if ( ! empty($input['name'])) { |
|
62 | 62 | $args['EVT_name'] = sanitize_text_field($input['name']); |
63 | 63 | } |
64 | 64 | |
65 | - if (! empty($input['order'])) { |
|
65 | + if ( ! empty($input['order'])) { |
|
66 | 66 | $args['EVT_order'] = absint($input['order']); |
67 | 67 | } |
68 | 68 | |
69 | - if (! empty($input['phone'])) { |
|
69 | + if ( ! empty($input['phone'])) { |
|
70 | 70 | $args['EVT_phone'] = sanitize_text_field($input['phone']); |
71 | 71 | } |
72 | 72 | |
73 | - if (! empty($input['shortDescription'])) { |
|
73 | + if ( ! empty($input['shortDescription'])) { |
|
74 | 74 | $args['EVT_short_desc'] = sanitize_post_field('post_excerpt', $input['shortDescription'], null, $context = 'db'); |
75 | 75 | } |
76 | 76 | |
77 | - if (! empty($input['timezoneString'])) { |
|
77 | + if ( ! empty($input['timezoneString'])) { |
|
78 | 78 | $args['EVT_timezone_string'] = sanitize_text_field($input['timezoneString']); |
79 | 79 | } |
80 | 80 | |
81 | - if (! empty($input['visibleOn'])) { |
|
81 | + if ( ! empty($input['visibleOn'])) { |
|
82 | 82 | $args['EVT_visible_on'] = new DateTime(sanitize_text_field($input['visibleOn'])); |
83 | 83 | } |
84 | 84 | |
85 | - if (! empty($input['wpUser'])) { |
|
85 | + if ( ! empty($input['wpUser'])) { |
|
86 | 86 | $args['EVT_wp_user'] = absint($input['wpUser']); |
87 | 87 | } |
88 | 88 |