@@ 12-45 (lines=34) @@ | ||
9 | * @package Event Espresso |
|
10 | * @author Manzoor Wani |
|
11 | */ |
|
12 | class EventMutation |
|
13 | { |
|
14 | ||
15 | /** |
|
16 | * Maps the GraphQL input to a format that the model functions can use |
|
17 | * |
|
18 | * @param array $input Data coming from the GraphQL mutation query input |
|
19 | * @param string $mutation_name Name of the mutation being performed |
|
20 | * |
|
21 | * @return array |
|
22 | */ |
|
23 | public static function prepare_fields(array $input, $mutation_name) |
|
24 | { |
|
25 | ||
26 | $args = []; |
|
27 | ||
28 | if ( ! empty( $input['name'] ) ) { |
|
29 | $args['EVT_name'] = sanitize_text_field( $input['name'] ); |
|
30 | } |
|
31 | ||
32 | if ( ! empty( $input['desc'] ) ) { |
|
33 | $args['EVT_desc'] = sanitize_text_field( $input['desc'] ); |
|
34 | } |
|
35 | ||
36 | if ( ! empty( $input['shortDesc'] ) ) { |
|
37 | $args['EVT_short_desc'] = sanitize_text_field( $input['shortDesc'] ); |
|
38 | } |
|
39 | ||
40 | // Likewise the other fields... |
|
41 | ||
42 | return $args; |
|
43 | } |
|
44 | ||
45 | } |
|
46 |
@@ 10-43 (lines=34) @@ | ||
7 | * @package Venue Espresso |
|
8 | * @author Manzoor Wani |
|
9 | */ |
|
10 | class VenueMutation |
|
11 | { |
|
12 | ||
13 | /** |
|
14 | * Maps the GraphQL input to a format that the model functions can use |
|
15 | * |
|
16 | * @param array $input Data coming from the GraphQL mutation query input |
|
17 | * @param string $mutation_name Name of the mutation being performed |
|
18 | * |
|
19 | * @return array |
|
20 | */ |
|
21 | public static function prepare_fields(array $input, $mutation_name) |
|
22 | { |
|
23 | ||
24 | $args = []; |
|
25 | ||
26 | if ( ! empty( $input['name'] ) ) { |
|
27 | $args['VNU_name'] = sanitize_text_field( $input['name'] ); |
|
28 | } |
|
29 | ||
30 | if ( ! empty( $input['desc'] ) ) { |
|
31 | $args['VNU_desc'] = sanitize_text_field( $input['desc'] ); |
|
32 | } |
|
33 | ||
34 | if ( ! empty( $input['shortDesc'] ) ) { |
|
35 | $args['VNU_short_desc'] = sanitize_text_field( $input['shortDesc'] ); |
|
36 | } |
|
37 | ||
38 | // Likewise the other fields... |
|
39 | ||
40 | return $args; |
|
41 | } |
|
42 | ||
43 | } |
|
44 |