|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace EventEspresso\core\domain\services\graphql\data\mutations; |
|
4
|
|
|
|
|
5
|
|
|
/** |
|
6
|
|
|
* Class VenueMutation |
|
7
|
|
|
* |
|
8
|
|
|
* @package Event Espresso |
|
9
|
|
|
* @author Manzoor Wani |
|
10
|
|
|
*/ |
|
11
|
|
|
class VenueMutation |
|
12
|
|
|
{ |
|
13
|
|
|
|
|
14
|
|
|
/** |
|
15
|
|
|
* Maps the GraphQL input to a format that the model functions can use |
|
16
|
|
|
* |
|
17
|
|
|
* @param array $input Data coming from the GraphQL mutation query input |
|
18
|
|
|
* @param string $mutation_name Name of the mutation being performed |
|
19
|
|
|
* @return array |
|
20
|
|
|
*/ |
|
21
|
|
|
public static function prepareFields(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['description'])) { |
|
31
|
|
|
$args['VNU_desc'] = wp_kses_post($input['description']); |
|
32
|
|
|
} |
|
33
|
|
|
|
|
34
|
|
|
if (! empty($input['shortDescription'])) { |
|
35
|
|
|
$args['VNU_short_desc'] = sanitize_text_field($input['shortDescription']); |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
|
|
if (! empty($input['identifier'])) { |
|
39
|
|
|
$args['VNU_identifier'] = sanitize_title($input['identifier']); |
|
40
|
|
|
} |
|
41
|
|
|
|
|
42
|
|
|
if (! empty($input['created'])) { |
|
43
|
|
|
$args['VNU_created'] = new DateTime(sanitize_text_field($input['created'])); |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
if (! empty($input['order'])) { |
|
47
|
|
|
$args['VNU_order'] = absint($input['order']); |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
if (! empty($input['wpUser'])) { |
|
51
|
|
|
$args['VNU_wp_user'] = absint($input['wpUser']); |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
if (! empty($input['address'])) { |
|
55
|
|
|
$args['VNU_address'] = sanitize_text_field($input['address']); |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
if (! empty($input['address2'])) { |
|
59
|
|
|
$args['VNU_address2'] = sanitize_text_field($input['address2']); |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
if (! empty($input['city'])) { |
|
63
|
|
|
$args['VNU_city'] = sanitize_text_field($input['city']); |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
if (! empty($input['state'])) { |
|
67
|
|
|
$args['STA_ID'] = absint($input['state']); |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
|
if (! empty($input['country'])) { |
|
71
|
|
|
$args['CNT_ISO'] = sanitize_text_field($input['country']); |
|
72
|
|
|
} |
|
73
|
|
|
|
|
74
|
|
|
if (! empty($input['zip'])) { |
|
75
|
|
|
$args['VNU_zip'] = sanitize_text_field($input['zip']); |
|
76
|
|
|
} |
|
77
|
|
|
|
|
78
|
|
|
if (! empty($input['capacity'])) { |
|
79
|
|
|
$args['VNU_capacity'] = absint($input['capacity']); |
|
80
|
|
|
} |
|
81
|
|
|
|
|
82
|
|
|
if (! empty($input['phone'])) { |
|
83
|
|
|
$args['VNU_phone'] = sanitize_text_field($input['phone']); |
|
84
|
|
|
} |
|
85
|
|
|
|
|
86
|
|
|
if (! empty($input['virtualPhone'])) { |
|
87
|
|
|
$args['VNU_virtual_phone'] = sanitize_text_field($input['virtualPhone']); |
|
88
|
|
|
} |
|
89
|
|
|
|
|
90
|
|
|
if (! empty($input['url'])) { |
|
91
|
|
|
$args['VNU_url'] = sanitize_text_field($input['url']); |
|
92
|
|
|
} |
|
93
|
|
|
|
|
94
|
|
|
if (! empty($input['virtualUrl'])) { |
|
95
|
|
|
$args['VNU_virtual_url'] = sanitize_text_field($input['virtualUrl']); |
|
96
|
|
|
} |
|
97
|
|
|
|
|
98
|
|
|
if (! empty($input['googleMapLink'])) { |
|
99
|
|
|
$args['VNU_google_map_link'] = sanitize_text_field($input['googleMapLink']); |
|
100
|
|
|
} |
|
101
|
|
|
|
|
102
|
|
|
if (! empty($input['enableForGmap'])) { |
|
103
|
|
|
$args['VNU_enable_for_gmap'] = (bool) $input['enableForGmap']; |
|
104
|
|
|
} |
|
105
|
|
|
|
|
106
|
|
|
return apply_filters( |
|
107
|
|
|
'FHEE__EventEspresso_core_domain_services_graphql_data_mutations__venue_args', |
|
108
|
|
|
$args, |
|
109
|
|
|
$input |
|
110
|
|
|
); |
|
111
|
|
|
} |
|
112
|
|
|
} |
|
113
|
|
|
|