@@ -27,234 +27,234 @@ |
||
27 | 27 | class Venue extends TypeBase |
28 | 28 | { |
29 | 29 | |
30 | - /** |
|
31 | - * Venue constructor. |
|
32 | - * |
|
33 | - * @param EEM_Venue $venue_model |
|
34 | - */ |
|
35 | - public function __construct(EEM_Venue $venue_model) |
|
36 | - { |
|
37 | - $this->setName($this->namespace . 'Venue'); |
|
38 | - $this->setIsCustomPostType(true); |
|
39 | - parent::__construct($venue_model); |
|
40 | - } |
|
30 | + /** |
|
31 | + * Venue constructor. |
|
32 | + * |
|
33 | + * @param EEM_Venue $venue_model |
|
34 | + */ |
|
35 | + public function __construct(EEM_Venue $venue_model) |
|
36 | + { |
|
37 | + $this->setName($this->namespace . 'Venue'); |
|
38 | + $this->setIsCustomPostType(true); |
|
39 | + parent::__construct($venue_model); |
|
40 | + } |
|
41 | 41 | |
42 | 42 | |
43 | - /** |
|
44 | - * @return GraphQLFieldInterface[] |
|
45 | - */ |
|
46 | - public function getFields(): array |
|
47 | - { |
|
48 | - $fields = [ |
|
49 | - new GraphQLOutputField( |
|
50 | - 'dbId', |
|
51 | - ['non_null' => 'Int'], |
|
52 | - 'ID', |
|
53 | - esc_html__('The venue ID.', 'event_espresso') |
|
54 | - ), |
|
55 | - new GraphQLOutputField( |
|
56 | - 'cacheId', |
|
57 | - ['non_null' => 'String'], |
|
58 | - null, |
|
59 | - esc_html__('The cache ID of the object.', 'event_espresso') |
|
60 | - ), |
|
61 | - new GraphQLField( |
|
62 | - 'name', |
|
63 | - 'String', |
|
64 | - 'name', |
|
65 | - esc_html__('Venue Name', 'event_espresso') |
|
66 | - ), |
|
67 | - new GraphQLField( |
|
68 | - 'description', |
|
69 | - 'String', |
|
70 | - 'description', |
|
71 | - esc_html__('Venue Description', 'event_espresso') |
|
72 | - ), |
|
73 | - new GraphQLField( |
|
74 | - 'shortDescription', |
|
75 | - 'String', |
|
76 | - 'excerpt', |
|
77 | - esc_html__('Short Description of Venue', 'event_espresso') |
|
78 | - ), |
|
79 | - new GraphQLField( |
|
80 | - 'identifier', |
|
81 | - 'String', |
|
82 | - 'identifier', |
|
83 | - esc_html__('Venue Identifier', 'event_espresso') |
|
84 | - ), |
|
85 | - new GraphQLField( |
|
86 | - 'created', |
|
87 | - 'String', |
|
88 | - 'created', |
|
89 | - esc_html__('Date Venue Created', 'event_espresso') |
|
90 | - ), |
|
91 | - new GraphQLField( |
|
92 | - 'order', |
|
93 | - 'Int', |
|
94 | - 'order', |
|
95 | - esc_html__('Venue order', 'event_espresso') |
|
96 | - ), |
|
97 | - new GraphQLOutputField( |
|
98 | - 'wpUser', |
|
99 | - 'User', |
|
100 | - null, |
|
101 | - esc_html__('Venue Creator', 'event_espresso') |
|
102 | - ), |
|
103 | - new GraphQLInputField( |
|
104 | - 'wpUser', |
|
105 | - 'Int', |
|
106 | - null, |
|
107 | - esc_html__('Venue Creator ID', 'event_espresso') |
|
108 | - ), |
|
109 | - new GraphQLField( |
|
110 | - 'address', |
|
111 | - 'String', |
|
112 | - 'address', |
|
113 | - esc_html__('Venue Address line 1', 'event_espresso') |
|
114 | - ), |
|
115 | - new GraphQLField( |
|
116 | - 'address2', |
|
117 | - 'String', |
|
118 | - 'address2', |
|
119 | - esc_html__('Venue Address line 2', 'event_espresso') |
|
120 | - ), |
|
121 | - new GraphQLField( |
|
122 | - 'city', |
|
123 | - 'String', |
|
124 | - 'city', |
|
125 | - esc_html__('Venue City', 'event_espresso') |
|
126 | - ), |
|
127 | - new GraphQLOutputField( |
|
128 | - 'state', |
|
129 | - $this->namespace . 'State', |
|
130 | - null, |
|
131 | - esc_html__('Venue state', 'event_espresso') |
|
132 | - ), |
|
133 | - new GraphQLOutputField( |
|
134 | - 'stateName', |
|
135 | - 'String', |
|
136 | - 'state_name', |
|
137 | - esc_html__('Venue state name', 'event_espresso') |
|
138 | - ), |
|
139 | - new GraphQLInputField( |
|
140 | - 'state', |
|
141 | - 'Int', |
|
142 | - null, |
|
143 | - esc_html__('State ID', 'event_espresso') |
|
144 | - ), |
|
145 | - new GraphQLOutputField( |
|
146 | - 'country', |
|
147 | - $this->namespace . 'Country', |
|
148 | - null, |
|
149 | - esc_html__('Venue country', 'event_espresso') |
|
150 | - ), |
|
151 | - new GraphQLOutputField( |
|
152 | - 'countryName', |
|
153 | - 'String', |
|
154 | - 'country_name', |
|
155 | - esc_html__('Venue country name', 'event_espresso') |
|
156 | - ), |
|
157 | - new GraphQLInputField( |
|
158 | - 'country', |
|
159 | - 'String', |
|
160 | - null, |
|
161 | - esc_html__('Country ISO Code', 'event_espresso') |
|
162 | - ), |
|
163 | - new GraphQLField( |
|
164 | - 'zip', |
|
165 | - 'String', |
|
166 | - 'zip', |
|
167 | - esc_html__('Venue Zip/Postal Code', 'event_espresso') |
|
168 | - ), |
|
169 | - new GraphQLField( |
|
170 | - 'capacity', |
|
171 | - 'Int', |
|
172 | - 'capacity', |
|
173 | - esc_html__('Venue Capacity', 'event_espresso'), |
|
174 | - [$this, 'parseInfiniteValue'] |
|
175 | - ), |
|
176 | - new GraphQLField( |
|
177 | - 'phone', |
|
178 | - 'String', |
|
179 | - 'phone', |
|
180 | - esc_html__('Venue Phone', 'event_espresso') |
|
181 | - ), |
|
182 | - new GraphQLField( |
|
183 | - 'virtualPhone', |
|
184 | - 'String', |
|
185 | - 'virtual_phone', |
|
186 | - esc_html__('Call in Number', 'event_espresso') |
|
187 | - ), |
|
188 | - new GraphQLField( |
|
189 | - 'url', |
|
190 | - 'String', |
|
191 | - 'venue_url', |
|
192 | - esc_html__('Venue Website', 'event_espresso') |
|
193 | - ), |
|
194 | - new GraphQLField( |
|
195 | - 'virtualUrl', |
|
196 | - 'String', |
|
197 | - 'virtual_url', |
|
198 | - esc_html__('Virtual URL', 'event_espresso') |
|
199 | - ), |
|
200 | - new GraphQLField( |
|
201 | - 'googleMapLink', |
|
202 | - 'String', |
|
203 | - 'google_map_link', |
|
204 | - esc_html__('Google Map Link', 'event_espresso') |
|
205 | - ), |
|
206 | - new GraphQLField( |
|
207 | - 'enableForGmap', |
|
208 | - 'String', |
|
209 | - 'enable_for_gmap', |
|
210 | - esc_html__('Show Google Map?', 'event_espresso') |
|
211 | - ), |
|
212 | - new GraphQLOutputField( |
|
213 | - 'thumbnail', |
|
214 | - 'String', |
|
215 | - 'thumbnail', |
|
216 | - esc_html__('Venue Thumbnail', 'event_espresso'), |
|
217 | - null, |
|
218 | - [$this, 'getThumbnail'] |
|
219 | - ), |
|
220 | - ]; |
|
43 | + /** |
|
44 | + * @return GraphQLFieldInterface[] |
|
45 | + */ |
|
46 | + public function getFields(): array |
|
47 | + { |
|
48 | + $fields = [ |
|
49 | + new GraphQLOutputField( |
|
50 | + 'dbId', |
|
51 | + ['non_null' => 'Int'], |
|
52 | + 'ID', |
|
53 | + esc_html__('The venue ID.', 'event_espresso') |
|
54 | + ), |
|
55 | + new GraphQLOutputField( |
|
56 | + 'cacheId', |
|
57 | + ['non_null' => 'String'], |
|
58 | + null, |
|
59 | + esc_html__('The cache ID of the object.', 'event_espresso') |
|
60 | + ), |
|
61 | + new GraphQLField( |
|
62 | + 'name', |
|
63 | + 'String', |
|
64 | + 'name', |
|
65 | + esc_html__('Venue Name', 'event_espresso') |
|
66 | + ), |
|
67 | + new GraphQLField( |
|
68 | + 'description', |
|
69 | + 'String', |
|
70 | + 'description', |
|
71 | + esc_html__('Venue Description', 'event_espresso') |
|
72 | + ), |
|
73 | + new GraphQLField( |
|
74 | + 'shortDescription', |
|
75 | + 'String', |
|
76 | + 'excerpt', |
|
77 | + esc_html__('Short Description of Venue', 'event_espresso') |
|
78 | + ), |
|
79 | + new GraphQLField( |
|
80 | + 'identifier', |
|
81 | + 'String', |
|
82 | + 'identifier', |
|
83 | + esc_html__('Venue Identifier', 'event_espresso') |
|
84 | + ), |
|
85 | + new GraphQLField( |
|
86 | + 'created', |
|
87 | + 'String', |
|
88 | + 'created', |
|
89 | + esc_html__('Date Venue Created', 'event_espresso') |
|
90 | + ), |
|
91 | + new GraphQLField( |
|
92 | + 'order', |
|
93 | + 'Int', |
|
94 | + 'order', |
|
95 | + esc_html__('Venue order', 'event_espresso') |
|
96 | + ), |
|
97 | + new GraphQLOutputField( |
|
98 | + 'wpUser', |
|
99 | + 'User', |
|
100 | + null, |
|
101 | + esc_html__('Venue Creator', 'event_espresso') |
|
102 | + ), |
|
103 | + new GraphQLInputField( |
|
104 | + 'wpUser', |
|
105 | + 'Int', |
|
106 | + null, |
|
107 | + esc_html__('Venue Creator ID', 'event_espresso') |
|
108 | + ), |
|
109 | + new GraphQLField( |
|
110 | + 'address', |
|
111 | + 'String', |
|
112 | + 'address', |
|
113 | + esc_html__('Venue Address line 1', 'event_espresso') |
|
114 | + ), |
|
115 | + new GraphQLField( |
|
116 | + 'address2', |
|
117 | + 'String', |
|
118 | + 'address2', |
|
119 | + esc_html__('Venue Address line 2', 'event_espresso') |
|
120 | + ), |
|
121 | + new GraphQLField( |
|
122 | + 'city', |
|
123 | + 'String', |
|
124 | + 'city', |
|
125 | + esc_html__('Venue City', 'event_espresso') |
|
126 | + ), |
|
127 | + new GraphQLOutputField( |
|
128 | + 'state', |
|
129 | + $this->namespace . 'State', |
|
130 | + null, |
|
131 | + esc_html__('Venue state', 'event_espresso') |
|
132 | + ), |
|
133 | + new GraphQLOutputField( |
|
134 | + 'stateName', |
|
135 | + 'String', |
|
136 | + 'state_name', |
|
137 | + esc_html__('Venue state name', 'event_espresso') |
|
138 | + ), |
|
139 | + new GraphQLInputField( |
|
140 | + 'state', |
|
141 | + 'Int', |
|
142 | + null, |
|
143 | + esc_html__('State ID', 'event_espresso') |
|
144 | + ), |
|
145 | + new GraphQLOutputField( |
|
146 | + 'country', |
|
147 | + $this->namespace . 'Country', |
|
148 | + null, |
|
149 | + esc_html__('Venue country', 'event_espresso') |
|
150 | + ), |
|
151 | + new GraphQLOutputField( |
|
152 | + 'countryName', |
|
153 | + 'String', |
|
154 | + 'country_name', |
|
155 | + esc_html__('Venue country name', 'event_espresso') |
|
156 | + ), |
|
157 | + new GraphQLInputField( |
|
158 | + 'country', |
|
159 | + 'String', |
|
160 | + null, |
|
161 | + esc_html__('Country ISO Code', 'event_espresso') |
|
162 | + ), |
|
163 | + new GraphQLField( |
|
164 | + 'zip', |
|
165 | + 'String', |
|
166 | + 'zip', |
|
167 | + esc_html__('Venue Zip/Postal Code', 'event_espresso') |
|
168 | + ), |
|
169 | + new GraphQLField( |
|
170 | + 'capacity', |
|
171 | + 'Int', |
|
172 | + 'capacity', |
|
173 | + esc_html__('Venue Capacity', 'event_espresso'), |
|
174 | + [$this, 'parseInfiniteValue'] |
|
175 | + ), |
|
176 | + new GraphQLField( |
|
177 | + 'phone', |
|
178 | + 'String', |
|
179 | + 'phone', |
|
180 | + esc_html__('Venue Phone', 'event_espresso') |
|
181 | + ), |
|
182 | + new GraphQLField( |
|
183 | + 'virtualPhone', |
|
184 | + 'String', |
|
185 | + 'virtual_phone', |
|
186 | + esc_html__('Call in Number', 'event_espresso') |
|
187 | + ), |
|
188 | + new GraphQLField( |
|
189 | + 'url', |
|
190 | + 'String', |
|
191 | + 'venue_url', |
|
192 | + esc_html__('Venue Website', 'event_espresso') |
|
193 | + ), |
|
194 | + new GraphQLField( |
|
195 | + 'virtualUrl', |
|
196 | + 'String', |
|
197 | + 'virtual_url', |
|
198 | + esc_html__('Virtual URL', 'event_espresso') |
|
199 | + ), |
|
200 | + new GraphQLField( |
|
201 | + 'googleMapLink', |
|
202 | + 'String', |
|
203 | + 'google_map_link', |
|
204 | + esc_html__('Google Map Link', 'event_espresso') |
|
205 | + ), |
|
206 | + new GraphQLField( |
|
207 | + 'enableForGmap', |
|
208 | + 'String', |
|
209 | + 'enable_for_gmap', |
|
210 | + esc_html__('Show Google Map?', 'event_espresso') |
|
211 | + ), |
|
212 | + new GraphQLOutputField( |
|
213 | + 'thumbnail', |
|
214 | + 'String', |
|
215 | + 'thumbnail', |
|
216 | + esc_html__('Venue Thumbnail', 'event_espresso'), |
|
217 | + null, |
|
218 | + [$this, 'getThumbnail'] |
|
219 | + ), |
|
220 | + ]; |
|
221 | 221 | |
222 | - return apply_filters( |
|
223 | - 'FHEE__EventEspresso_core_domain_services_graphql_types__venue_fields', |
|
224 | - $fields, |
|
225 | - $this->name, |
|
226 | - $this->model |
|
227 | - ); |
|
228 | - } |
|
222 | + return apply_filters( |
|
223 | + 'FHEE__EventEspresso_core_domain_services_graphql_types__venue_fields', |
|
224 | + $fields, |
|
225 | + $this->name, |
|
226 | + $this->model |
|
227 | + ); |
|
228 | + } |
|
229 | 229 | |
230 | 230 | |
231 | - /** |
|
232 | - * Extends the existing WP GraphQL mutations. |
|
233 | - * |
|
234 | - * @return void |
|
235 | - */ |
|
236 | - public function extendMutations() |
|
237 | - { |
|
238 | - add_action( |
|
239 | - 'graphql_post_object_mutation_update_additional_data', |
|
240 | - VenueUpdate::mutateFields($this->model, $this), |
|
241 | - 10, |
|
242 | - 6 |
|
243 | - ); |
|
244 | - } |
|
231 | + /** |
|
232 | + * Extends the existing WP GraphQL mutations. |
|
233 | + * |
|
234 | + * @return void |
|
235 | + */ |
|
236 | + public function extendMutations() |
|
237 | + { |
|
238 | + add_action( |
|
239 | + 'graphql_post_object_mutation_update_additional_data', |
|
240 | + VenueUpdate::mutateFields($this->model, $this), |
|
241 | + 10, |
|
242 | + 6 |
|
243 | + ); |
|
244 | + } |
|
245 | 245 | |
246 | 246 | |
247 | - /** |
|
248 | - * @param EE_Venue $venue |
|
249 | - * @param array $args |
|
250 | - * @param AppContext $context |
|
251 | - * @param ResolveInfo $info |
|
252 | - * @return string |
|
253 | - * @throws EE_Error |
|
254 | - * @throws ReflectionException |
|
255 | - */ |
|
256 | - public function getThumbnail(EE_Venue $venue, array $args, AppContext $context, ResolveInfo $info): string |
|
257 | - { |
|
258 | - return get_the_post_thumbnail($venue->ID(), 'medium'); |
|
259 | - } |
|
247 | + /** |
|
248 | + * @param EE_Venue $venue |
|
249 | + * @param array $args |
|
250 | + * @param AppContext $context |
|
251 | + * @param ResolveInfo $info |
|
252 | + * @return string |
|
253 | + * @throws EE_Error |
|
254 | + * @throws ReflectionException |
|
255 | + */ |
|
256 | + public function getThumbnail(EE_Venue $venue, array $args, AppContext $context, ResolveInfo $info): string |
|
257 | + { |
|
258 | + return get_the_post_thumbnail($venue->ID(), 'medium'); |
|
259 | + } |
|
260 | 260 | } |
@@ -15,243 +15,243 @@ |
||
15 | 15 | class Event_Edit_Help_Tour extends EE_Help_Tour |
16 | 16 | { |
17 | 17 | |
18 | - protected function _set_tour_properties() |
|
19 | - { |
|
20 | - $this->_label = __('Event Editor Tour', 'event_espresso'); |
|
21 | - $this->_slug = $this->_is_caf ? 'event-edit-caf-joyride' : 'event-edit-joyride'; |
|
22 | - } |
|
18 | + protected function _set_tour_properties() |
|
19 | + { |
|
20 | + $this->_label = __('Event Editor Tour', 'event_espresso'); |
|
21 | + $this->_slug = $this->_is_caf ? 'event-edit-caf-joyride' : 'event-edit-joyride'; |
|
22 | + } |
|
23 | 23 | |
24 | - protected function _set_tour_stops() |
|
25 | - { |
|
26 | - $this->_stops = array( |
|
27 | - 10 => array( |
|
28 | - 'content' => $this->_start(), |
|
29 | - ), |
|
30 | - 20 => array( |
|
31 | - 'id' => 'titlewrap', |
|
32 | - 'content' => $this->_event_title_stop(), |
|
33 | - 'options' => array( |
|
34 | - 'tipLocation' => 'bottom', |
|
35 | - 'tipAdjustmentY' => -40, |
|
36 | - ), |
|
37 | - ), |
|
38 | - 30 => array( |
|
39 | - 'id' => 'wp-content-editor-tools', |
|
40 | - 'content' => $this->_event_description_stop(), |
|
41 | - 'options' => array( |
|
42 | - 'tipLocation' => 'right', |
|
43 | - ), |
|
44 | - ), |
|
45 | - 35 => array( |
|
46 | - 'id' => 'espresso_event_editor_tickets', |
|
47 | - 'content' => $this->_event_pricing_stop(), |
|
48 | - 'options' => array( |
|
49 | - 'tipLocation' => 'top', |
|
50 | - 'tipAdjustmentY' => -30, |
|
51 | - ), |
|
52 | - ), |
|
53 | - 40 => array( |
|
54 | - 'id' => 'espresso_events_Venues_Hooks_venue_metabox_metabox', |
|
55 | - 'content' => $this->_event_venues_caf(), |
|
56 | - 'options' => array( |
|
57 | - 'tipLocation' => 'top', |
|
58 | - 'tipAdjustmentY' => -30, |
|
59 | - ), |
|
60 | - ), |
|
61 | - 45 => array( |
|
62 | - 'id' => 'espresso_event_editor_venue', |
|
63 | - 'content' => $this->_event_venues_stop(), |
|
64 | - 'options' => array( |
|
65 | - 'tipLocation' => 'top', |
|
66 | - 'tipAdjustmentY' => -30, |
|
67 | - ), |
|
68 | - ), |
|
69 | - 50 => array( |
|
70 | - 'id' => 'espresso_events_Pricing_Hooks_pricing_metabox_metabox', |
|
71 | - 'content' => $this->_event_pricing_caf(), |
|
72 | - 'options' => array( |
|
73 | - 'tipLocation' => 'top', |
|
74 | - 'tipAdjustmentY' => -30, |
|
75 | - ), |
|
76 | - ), |
|
77 | - 60 => array( |
|
78 | - 'id' => 'tagsdiv-post_tag', |
|
79 | - 'content' => $this->_event_post_tag_stop(), |
|
80 | - 'options' => array( |
|
81 | - 'tipLocation' => 'left', |
|
82 | - ), |
|
83 | - ), |
|
84 | - 70 => array( |
|
85 | - 'id' => 'espresso_event_categoriesdiv', |
|
86 | - 'content' => $this->_event_categories_stop(), |
|
87 | - 'options' => array( |
|
88 | - 'tipLocation' => 'left', |
|
89 | - ), |
|
90 | - ), |
|
24 | + protected function _set_tour_stops() |
|
25 | + { |
|
26 | + $this->_stops = array( |
|
27 | + 10 => array( |
|
28 | + 'content' => $this->_start(), |
|
29 | + ), |
|
30 | + 20 => array( |
|
31 | + 'id' => 'titlewrap', |
|
32 | + 'content' => $this->_event_title_stop(), |
|
33 | + 'options' => array( |
|
34 | + 'tipLocation' => 'bottom', |
|
35 | + 'tipAdjustmentY' => -40, |
|
36 | + ), |
|
37 | + ), |
|
38 | + 30 => array( |
|
39 | + 'id' => 'wp-content-editor-tools', |
|
40 | + 'content' => $this->_event_description_stop(), |
|
41 | + 'options' => array( |
|
42 | + 'tipLocation' => 'right', |
|
43 | + ), |
|
44 | + ), |
|
45 | + 35 => array( |
|
46 | + 'id' => 'espresso_event_editor_tickets', |
|
47 | + 'content' => $this->_event_pricing_stop(), |
|
48 | + 'options' => array( |
|
49 | + 'tipLocation' => 'top', |
|
50 | + 'tipAdjustmentY' => -30, |
|
51 | + ), |
|
52 | + ), |
|
53 | + 40 => array( |
|
54 | + 'id' => 'espresso_events_Venues_Hooks_venue_metabox_metabox', |
|
55 | + 'content' => $this->_event_venues_caf(), |
|
56 | + 'options' => array( |
|
57 | + 'tipLocation' => 'top', |
|
58 | + 'tipAdjustmentY' => -30, |
|
59 | + ), |
|
60 | + ), |
|
61 | + 45 => array( |
|
62 | + 'id' => 'espresso_event_editor_venue', |
|
63 | + 'content' => $this->_event_venues_stop(), |
|
64 | + 'options' => array( |
|
65 | + 'tipLocation' => 'top', |
|
66 | + 'tipAdjustmentY' => -30, |
|
67 | + ), |
|
68 | + ), |
|
69 | + 50 => array( |
|
70 | + 'id' => 'espresso_events_Pricing_Hooks_pricing_metabox_metabox', |
|
71 | + 'content' => $this->_event_pricing_caf(), |
|
72 | + 'options' => array( |
|
73 | + 'tipLocation' => 'top', |
|
74 | + 'tipAdjustmentY' => -30, |
|
75 | + ), |
|
76 | + ), |
|
77 | + 60 => array( |
|
78 | + 'id' => 'tagsdiv-post_tag', |
|
79 | + 'content' => $this->_event_post_tag_stop(), |
|
80 | + 'options' => array( |
|
81 | + 'tipLocation' => 'left', |
|
82 | + ), |
|
83 | + ), |
|
84 | + 70 => array( |
|
85 | + 'id' => 'espresso_event_categoriesdiv', |
|
86 | + 'content' => $this->_event_categories_stop(), |
|
87 | + 'options' => array( |
|
88 | + 'tipLocation' => 'left', |
|
89 | + ), |
|
90 | + ), |
|
91 | 91 | |
92 | - 80 => array( |
|
93 | - 'id' => $this->_is_caf ? 'espresso_events_Registration_Form_Hooks_Extend_primary_questions_metabox' |
|
94 | - : 'espresso_events_Registration_Form_Hooks_primary_questions_metabox', |
|
95 | - 'content' => $this->_primary_question_stop_caf(), |
|
96 | - 'options' => array( |
|
97 | - 'tipLocation' => 'left', |
|
98 | - ), |
|
99 | - ), |
|
100 | - 90 => array( |
|
101 | - 'id' => 'espresso_events_Registration_Form_Hooks_Extend_additional_questions_metabox', |
|
102 | - 'content' => $this->_additional_questions_stop_caf(), |
|
103 | - 'options' => array( |
|
104 | - 'tipLocation' => 'left', |
|
105 | - ), |
|
106 | - ), |
|
107 | - 100 => array( |
|
108 | - 'id' => 'postimagediv', |
|
109 | - 'content' => $this->_featured_image_stop(), |
|
110 | - 'options' => array( |
|
111 | - 'tipLocation' => 'left', |
|
112 | - ), |
|
113 | - ), |
|
114 | - 110 => array( |
|
115 | - 'id' => 'espresso_event_editor_event_options', |
|
116 | - 'content' => $this->_event_registration_options_stop(), |
|
117 | - 'options' => array( |
|
118 | - 'tipLocation' => 'left', |
|
119 | - ), |
|
120 | - ), |
|
121 | - 120 => array( |
|
122 | - 'id' => 'submitpost', |
|
123 | - 'content' => $this->_publish_event_stop(), |
|
124 | - 'options' => array( |
|
125 | - 'tipLocation' => 'left', |
|
126 | - ), |
|
127 | - ), |
|
128 | - ); |
|
92 | + 80 => array( |
|
93 | + 'id' => $this->_is_caf ? 'espresso_events_Registration_Form_Hooks_Extend_primary_questions_metabox' |
|
94 | + : 'espresso_events_Registration_Form_Hooks_primary_questions_metabox', |
|
95 | + 'content' => $this->_primary_question_stop_caf(), |
|
96 | + 'options' => array( |
|
97 | + 'tipLocation' => 'left', |
|
98 | + ), |
|
99 | + ), |
|
100 | + 90 => array( |
|
101 | + 'id' => 'espresso_events_Registration_Form_Hooks_Extend_additional_questions_metabox', |
|
102 | + 'content' => $this->_additional_questions_stop_caf(), |
|
103 | + 'options' => array( |
|
104 | + 'tipLocation' => 'left', |
|
105 | + ), |
|
106 | + ), |
|
107 | + 100 => array( |
|
108 | + 'id' => 'postimagediv', |
|
109 | + 'content' => $this->_featured_image_stop(), |
|
110 | + 'options' => array( |
|
111 | + 'tipLocation' => 'left', |
|
112 | + ), |
|
113 | + ), |
|
114 | + 110 => array( |
|
115 | + 'id' => 'espresso_event_editor_event_options', |
|
116 | + 'content' => $this->_event_registration_options_stop(), |
|
117 | + 'options' => array( |
|
118 | + 'tipLocation' => 'left', |
|
119 | + ), |
|
120 | + ), |
|
121 | + 120 => array( |
|
122 | + 'id' => 'submitpost', |
|
123 | + 'content' => $this->_publish_event_stop(), |
|
124 | + 'options' => array( |
|
125 | + 'tipLocation' => 'left', |
|
126 | + ), |
|
127 | + ), |
|
128 | + ); |
|
129 | 129 | |
130 | - if (EE_Config::instance()->admin->useAdvancedEditor()) { |
|
131 | - unset( |
|
132 | - // description |
|
133 | - $this->_stops[30], |
|
134 | - // tickets |
|
135 | - $this->_stops[35], |
|
136 | - // venues |
|
137 | - $this->_stops[40], |
|
138 | - $this->_stops[45], |
|
139 | - // pricing |
|
140 | - $this->_stops[50], |
|
141 | - // questions |
|
142 | - $this->_stops[90], |
|
143 | - // reg options |
|
144 | - $this->_stops[110] |
|
145 | - ); |
|
146 | - } |
|
147 | - } |
|
130 | + if (EE_Config::instance()->admin->useAdvancedEditor()) { |
|
131 | + unset( |
|
132 | + // description |
|
133 | + $this->_stops[30], |
|
134 | + // tickets |
|
135 | + $this->_stops[35], |
|
136 | + // venues |
|
137 | + $this->_stops[40], |
|
138 | + $this->_stops[45], |
|
139 | + // pricing |
|
140 | + $this->_stops[50], |
|
141 | + // questions |
|
142 | + $this->_stops[90], |
|
143 | + // reg options |
|
144 | + $this->_stops[110] |
|
145 | + ); |
|
146 | + } |
|
147 | + } |
|
148 | 148 | |
149 | 149 | |
150 | - protected function _start() |
|
151 | - { |
|
152 | - $content = '<h3>' . __('Event Editor', 'event_espresso') . '</h3>'; |
|
153 | - $content .= '<p>' |
|
154 | - . __( |
|
155 | - 'This tour of the Event Editor will provide an overview of the different areas of the screen to help you understand what they are used for. Let\'s get started on setting up your first event with Event Espresso!', |
|
156 | - 'event_espresso' |
|
157 | - ) . '</p>'; |
|
158 | - return $content; |
|
159 | - } |
|
150 | + protected function _start() |
|
151 | + { |
|
152 | + $content = '<h3>' . __('Event Editor', 'event_espresso') . '</h3>'; |
|
153 | + $content .= '<p>' |
|
154 | + . __( |
|
155 | + 'This tour of the Event Editor will provide an overview of the different areas of the screen to help you understand what they are used for. Let\'s get started on setting up your first event with Event Espresso!', |
|
156 | + 'event_espresso' |
|
157 | + ) . '</p>'; |
|
158 | + return $content; |
|
159 | + } |
|
160 | 160 | |
161 | - protected function _event_title_stop() |
|
162 | - { |
|
163 | - return '<p>Enter the title for your event in this field.</p>'; |
|
164 | - } |
|
161 | + protected function _event_title_stop() |
|
162 | + { |
|
163 | + return '<p>Enter the title for your event in this field.</p>'; |
|
164 | + } |
|
165 | 165 | |
166 | - protected function _event_description_stop() |
|
167 | - { |
|
168 | - return '<p>' |
|
169 | - . __( |
|
170 | - 'The rich text editor can be used to add information about your event. Images and links can also be added along with your text.', |
|
171 | - 'event_espresso' |
|
172 | - ) . '</p>'; |
|
173 | - } |
|
166 | + protected function _event_description_stop() |
|
167 | + { |
|
168 | + return '<p>' |
|
169 | + . __( |
|
170 | + 'The rich text editor can be used to add information about your event. Images and links can also be added along with your text.', |
|
171 | + 'event_espresso' |
|
172 | + ) . '</p>'; |
|
173 | + } |
|
174 | 174 | |
175 | - protected function _event_venues_caf() |
|
176 | - { |
|
177 | - return '<p>' |
|
178 | - . __( |
|
179 | - 'In this section, you can select the venue that is hosting your event.', |
|
180 | - 'event_espresso' |
|
181 | - ) . '</p>'; |
|
182 | - } |
|
175 | + protected function _event_venues_caf() |
|
176 | + { |
|
177 | + return '<p>' |
|
178 | + . __( |
|
179 | + 'In this section, you can select the venue that is hosting your event.', |
|
180 | + 'event_espresso' |
|
181 | + ) . '</p>'; |
|
182 | + } |
|
183 | 183 | |
184 | - protected function _event_venues_stop() |
|
185 | - { |
|
186 | - return '<p>' |
|
187 | - . __( |
|
188 | - 'In this section, you can enter information about the venue that is hosting your event.', |
|
189 | - 'event_espresso' |
|
190 | - ) . '</p>'; |
|
191 | - } |
|
184 | + protected function _event_venues_stop() |
|
185 | + { |
|
186 | + return '<p>' |
|
187 | + . __( |
|
188 | + 'In this section, you can enter information about the venue that is hosting your event.', |
|
189 | + 'event_espresso' |
|
190 | + ) . '</p>'; |
|
191 | + } |
|
192 | 192 | |
193 | - protected function _event_pricing_stop() |
|
194 | - { |
|
195 | - return '<p>' |
|
196 | - . __( |
|
197 | - 'Use the Event Datetime & Ticket section to enter details about when the event is happening and what tickets you want to offer for access to the event.', |
|
198 | - 'event_espresso' |
|
199 | - ) . '</p>'; |
|
200 | - } |
|
193 | + protected function _event_pricing_stop() |
|
194 | + { |
|
195 | + return '<p>' |
|
196 | + . __( |
|
197 | + 'Use the Event Datetime & Ticket section to enter details about when the event is happening and what tickets you want to offer for access to the event.', |
|
198 | + 'event_espresso' |
|
199 | + ) . '</p>'; |
|
200 | + } |
|
201 | 201 | |
202 | - protected function _event_pricing_caf() |
|
203 | - { |
|
204 | - return '<p>' |
|
205 | - . __( |
|
206 | - 'Use the Event Datetimes & Ticket section to enter details about when the event is happening and what tickets you want to offer for access to the event.', |
|
207 | - 'event_espresso' |
|
208 | - ) . '</p>'; |
|
209 | - } |
|
202 | + protected function _event_pricing_caf() |
|
203 | + { |
|
204 | + return '<p>' |
|
205 | + . __( |
|
206 | + 'Use the Event Datetimes & Ticket section to enter details about when the event is happening and what tickets you want to offer for access to the event.', |
|
207 | + 'event_espresso' |
|
208 | + ) . '</p>'; |
|
209 | + } |
|
210 | 210 | |
211 | - protected function _event_registration_options_stop() |
|
212 | - { |
|
213 | - return '<p>' . __('Setup custom options for your event registration.', 'event_espresso') . '</p>'; |
|
214 | - } |
|
211 | + protected function _event_registration_options_stop() |
|
212 | + { |
|
213 | + return '<p>' . __('Setup custom options for your event registration.', 'event_espresso') . '</p>'; |
|
214 | + } |
|
215 | 215 | |
216 | - protected function _event_post_tag_stop() |
|
217 | - { |
|
218 | - return '<p>' . __('Quickly add tags to your event.', 'event_espresso') . '</p>'; |
|
219 | - } |
|
216 | + protected function _event_post_tag_stop() |
|
217 | + { |
|
218 | + return '<p>' . __('Quickly add tags to your event.', 'event_espresso') . '</p>'; |
|
219 | + } |
|
220 | 220 | |
221 | - protected function _event_categories_stop() |
|
222 | - { |
|
223 | - return '<p>' . __('Events can also be categorized if you wish.', 'event_espresso') . '</p>'; |
|
224 | - } |
|
221 | + protected function _event_categories_stop() |
|
222 | + { |
|
223 | + return '<p>' . __('Events can also be categorized if you wish.', 'event_espresso') . '</p>'; |
|
224 | + } |
|
225 | 225 | |
226 | - protected function _primary_question_stop_caf() |
|
227 | - { |
|
228 | - return '<p>' |
|
229 | - . __( |
|
230 | - 'Use the questions group to request information from your primary registrant.', |
|
231 | - 'event_espresso' |
|
232 | - ) . '</p>'; |
|
233 | - } |
|
226 | + protected function _primary_question_stop_caf() |
|
227 | + { |
|
228 | + return '<p>' |
|
229 | + . __( |
|
230 | + 'Use the questions group to request information from your primary registrant.', |
|
231 | + 'event_espresso' |
|
232 | + ) . '</p>'; |
|
233 | + } |
|
234 | 234 | |
235 | - protected function _additional_questions_stop_caf() |
|
236 | - { |
|
237 | - return '<p>' |
|
238 | - . __( |
|
239 | - 'Use the questions group to request information from your additional registrant.', |
|
240 | - 'event_espresso' |
|
241 | - ) . '</p>'; |
|
242 | - } |
|
235 | + protected function _additional_questions_stop_caf() |
|
236 | + { |
|
237 | + return '<p>' |
|
238 | + . __( |
|
239 | + 'Use the questions group to request information from your additional registrant.', |
|
240 | + 'event_espresso' |
|
241 | + ) . '</p>'; |
|
242 | + } |
|
243 | 243 | |
244 | - protected function _featured_image_stop() |
|
245 | - { |
|
246 | - return '<p>' . __('Set a feature image for your event here.', 'event_espresso') . '</p>'; |
|
247 | - } |
|
244 | + protected function _featured_image_stop() |
|
245 | + { |
|
246 | + return '<p>' . __('Set a feature image for your event here.', 'event_espresso') . '</p>'; |
|
247 | + } |
|
248 | 248 | |
249 | - protected function _publish_event_stop() |
|
250 | - { |
|
251 | - return '<p>' |
|
252 | - . __( |
|
253 | - 'Easily control the state of your event. The main states are Published, Pending Review, and Draft. Additional states are Cancelled, Postponed, and Sold Out.', |
|
254 | - 'event_espresso' |
|
255 | - ) . '</p>'; |
|
256 | - } |
|
249 | + protected function _publish_event_stop() |
|
250 | + { |
|
251 | + return '<p>' |
|
252 | + . __( |
|
253 | + 'Easily control the state of your event. The main states are Published, Pending Review, and Draft. Additional states are Cancelled, Postponed, and Sold Out.', |
|
254 | + 'event_espresso' |
|
255 | + ) . '</p>'; |
|
256 | + } |
|
257 | 257 | } |
@@ -15,216 +15,216 @@ |
||
15 | 15 | class espresso_events_Venues_Hooks extends EE_Admin_Hooks |
16 | 16 | { |
17 | 17 | |
18 | - /** |
|
19 | - * @var EE_Event |
|
20 | - */ |
|
21 | - protected $_event; |
|
22 | - |
|
23 | - |
|
24 | - public function __construct(EE_Admin_Page $admin_page) |
|
25 | - { |
|
26 | - parent::__construct($admin_page); |
|
27 | - } |
|
28 | - |
|
29 | - |
|
30 | - protected function _set_hooks_properties() |
|
31 | - { |
|
32 | - |
|
33 | - $this->_name = 'venues'; |
|
34 | - |
|
35 | - if (EE_Config::instance()->admin->useAdvancedEditor()) { |
|
36 | - $this->_metaboxes = []; |
|
37 | - $this->_scripts_styles = []; |
|
38 | - return; |
|
39 | - } |
|
40 | - $this->_metaboxes = array( |
|
41 | - 0 => array( |
|
42 | - 'page_route' => array('edit', 'create_new'), |
|
43 | - 'func' => 'venue_metabox', |
|
44 | - 'label' => __('Venue Details', 'event_espresso'), |
|
45 | - 'priority' => 'high', |
|
46 | - 'context' => 'normal', |
|
47 | - ), |
|
48 | - ); |
|
49 | - |
|
50 | - $this->_scripts_styles = array( |
|
51 | - 'registers' => array( |
|
52 | - 'ee_event_venues' => array( |
|
53 | - 'type' => 'js', |
|
54 | - 'url' => EE_VENUES_ASSETS_URL . 'ee-event-venues-admin.js', |
|
55 | - 'depends' => array('jquery'), |
|
56 | - ), |
|
57 | - 'ee_event_venues_css' => array( |
|
58 | - 'type' => 'css', |
|
59 | - 'url' => EE_VENUES_ASSETS_URL . 'ee-event-venues-admin.css', |
|
60 | - ), |
|
61 | - ), |
|
62 | - 'enqueues' => array( |
|
63 | - 'ee_event_venues' => array('edit', 'create_new'), |
|
64 | - 'ee_event_venues_css' => array('edit', 'create_new'), |
|
65 | - ), |
|
66 | - ); |
|
67 | - |
|
68 | - // hook into the handler for saving venue |
|
69 | - add_filter( |
|
70 | - 'FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', |
|
71 | - array($this, 'modify_callbacks'), |
|
72 | - 10 |
|
73 | - ); |
|
74 | - |
|
75 | - // remove default ee_autosave returns for DECAF venues (not needed for CAF venues cause we have a dropdown selector) |
|
76 | - add_filter('FHEE__Events_Admin_Page__ee_autosave_edit_do_decaf_venue_save', '__return_false'); |
|
77 | - } |
|
78 | - |
|
79 | - |
|
80 | - public function modify_callbacks($callbacks) |
|
81 | - { |
|
82 | - // first remove default venue callback |
|
83 | - foreach ($callbacks as $key => $callback) { |
|
84 | - if ($callback[1] == '_default_venue_update') { |
|
85 | - unset($callbacks[ $key ]); |
|
86 | - } |
|
87 | - } |
|
88 | - |
|
89 | - // now let's add the caf version |
|
90 | - $callbacks[] = array($this, 'caf_venue_update'); |
|
91 | - return $callbacks; |
|
92 | - } |
|
93 | - |
|
94 | - |
|
95 | - public function venue_metabox() |
|
96 | - { |
|
97 | - $evt_obj = $this->_adminpage_obj->get_event_object(); |
|
98 | - $evt_id = $evt_obj->ID(); |
|
99 | - |
|
100 | - // first let's see if we have a venue already |
|
101 | - $evt_venues = ! empty($evt_id) ? $evt_obj->venues() : array(); |
|
102 | - $evt_venue = $evt_venues && is_array($evt_venues) ? reset($evt_venues) : null; |
|
103 | - $evt_venue_id = $evt_venue instanceof EE_Venue ? $evt_venue->ID() : null; |
|
104 | - |
|
105 | - // possibly private venues. |
|
106 | - if (EE_Registry::instance()->CAP->current_user_can('ee_read_private_venues', 'get_venues')) { |
|
107 | - $vnu_where['status'] = array('IN', array('publish', 'private')); |
|
108 | - } else { |
|
109 | - $vnu_where['status'] = 'publish'; |
|
110 | - } |
|
111 | - |
|
112 | - // cap checks |
|
113 | - if (! EE_Registry::instance()->CAP->current_user_can('ee_read_others_venues', 'get_venues')) { |
|
114 | - $vnu_where['VNU_wp_user'] = get_current_user_id(); |
|
115 | - } |
|
116 | - |
|
117 | - $vnumdl = EE_Registry::instance()->load_model('Venue'); |
|
118 | - $venues = $vnumdl->get_all(array($vnu_where, 'order_by' => array('VNU_name' => 'ASC'))); |
|
119 | - |
|
120 | - $ven_select = array(); |
|
121 | - $ven_select[0] = __('Select a Venue', 'event_espresso'); |
|
122 | - // setup venues for selector |
|
123 | - foreach ($venues as $venue) { |
|
124 | - $ven_select[ $venue->ID() ] = $venue->name(); |
|
125 | - } |
|
126 | - |
|
127 | - // if $ven_select does not have the existing venue attached to event then let's add that because we'll always |
|
128 | - // show existing attached venues even if it's trashed (or some other restricted status). |
|
129 | - |
|
130 | - if ($evt_venue_id && ! isset($ven_select[ $evt_venue_id ])) { |
|
131 | - $ven_select[ $evt_venue_id ] = $evt_venue->name(); |
|
132 | - $venues = array_merge($venues, array($evt_venue)); |
|
133 | - } |
|
134 | - |
|
135 | - $template_args['venues'] = $venues; |
|
136 | - $template_args['evt_venue_id'] = $evt_venue_id; |
|
137 | - $venue_selector = new EE_Select_Input( |
|
138 | - $ven_select, |
|
139 | - array( |
|
140 | - 'html_name' => 'venue_id', |
|
141 | - 'html_id' => 'venue_id', |
|
142 | - 'html_class' => 'wide', |
|
143 | - 'default' => $evt_venue_id ? $evt_venue_id : '0' |
|
144 | - ) |
|
145 | - ); |
|
146 | - $template_args['venue_selector'] = $venue_selector->get_html_for_input(); |
|
147 | - $enable_for_gmap = new EE_Yes_No_Input( |
|
148 | - array( |
|
149 | - 'html_name' => 'enable_for_gmap', |
|
150 | - 'html_id' => 'enable_for_gmap', |
|
151 | - 'default' => $evt_venue instanceof EE_Venue ? $evt_venue->enable_for_gmap() : false |
|
152 | - ) |
|
153 | - ); |
|
154 | - $template_args['enable_for_gmap'] = $enable_for_gmap->get_html_for_input(); |
|
155 | - $template_args['new_venue_link'] = EEH_HTML::link( |
|
156 | - EE_Admin_Page::add_query_args_and_nonce( |
|
157 | - array('action' => 'create_new'), |
|
158 | - EE_VENUES_ADMIN_URL |
|
159 | - ), |
|
160 | - esc_html_x('Add new Venue', 'a link to add a new venue', 'event_espresso'), |
|
161 | - esc_html_x('Add new Venue', 'a link to add a new venue', 'event_espresso'), |
|
162 | - 'ev_new_venue_link', |
|
163 | - 'button', |
|
164 | - 'margin-left:10px;', |
|
165 | - 'target="_blank"' |
|
166 | - ); |
|
167 | - |
|
168 | - // Decide on an info text when there are no venues to display. |
|
169 | - $no_venues_info_txt = esc_html_x( |
|
170 | - 'You have not created any venues yet.', |
|
171 | - 'Information text displayed in the venues metabox when there are no venues to display', |
|
172 | - 'event_espresso' |
|
173 | - ); |
|
174 | - if (empty($venues)) { |
|
175 | - $unpublished_where = $vnu_where; |
|
176 | - $unpublished_where['status'] = 'draft'; |
|
177 | - $unpublished_venues = $vnumdl->get_all(array($unpublished_where, 'order_by' => array('VNU_name' => 'ASC'))); |
|
178 | - if (count($unpublished_venues) > 0) { |
|
179 | - $no_venues_info_txt = esc_html_x( |
|
180 | - // @codingStandardsIgnoreStart |
|
181 | - 'Use the link below to publish your venue through the venue editor so it appears here for selection.', |
|
182 | - // @codingStandardsIgnoreEnd |
|
183 | - 'Information text displayed in the venues metabox when there are no venues to display', |
|
184 | - 'event_espresso' |
|
185 | - ); |
|
186 | - } |
|
187 | - } |
|
188 | - $template_args['no_venues_info'] = EEH_HTML::p( |
|
189 | - EEH_HTML::strong($no_venues_info_txt), |
|
190 | - 'no_venues_info', |
|
191 | - 'info' |
|
192 | - ); |
|
193 | - |
|
194 | - $template_path = empty($venues) ? EE_VENUES_TEMPLATE_PATH . 'event_venues_metabox_content.template.php' |
|
195 | - : EE_VENUES_TEMPLATE_PATH . 'event_venues_metabox_content_from_manager.template.php'; |
|
196 | - |
|
197 | - // Allow events venue metabox template args filtering. |
|
198 | - $template_args = apply_filters( |
|
199 | - 'FHEE__espresso_events_Venues_Hooks___venue_metabox__template_args', |
|
200 | - $template_args, |
|
201 | - $template_path |
|
202 | - ); |
|
203 | - |
|
204 | - EEH_Template::display_template($template_path, $template_args); |
|
205 | - } |
|
206 | - |
|
207 | - |
|
208 | - public function caf_venue_update($evtobj, $data) |
|
209 | - { |
|
210 | - EE_Registry::instance()->load_model('Venue'); |
|
211 | - $venue_id = ! empty($data['venue_id']) ? $data['venue_id'] : null; |
|
212 | - |
|
213 | - |
|
214 | - // first let's check if the selected venue matches any existing venue attached to the event |
|
215 | - $evt_venue = $evtobj->venues(); |
|
216 | - $evt_venue = ! empty($evt_venue) ? array_shift($evt_venue) : null; |
|
217 | - |
|
218 | - if (! empty($evt_venue) && $evt_venue->ID() != $venue_id) { |
|
219 | - $evtobj->_remove_relation_to($evt_venue->ID(), 'Venue'); |
|
220 | - } |
|
221 | - |
|
222 | - if (empty($venue_id)) { |
|
223 | - return true; |
|
224 | - } //no venue to attach |
|
225 | - |
|
226 | - // this should take care of adding to revisions as well as main post object |
|
227 | - $success = $evtobj->_add_relation_to($venue_id, 'Venue'); |
|
228 | - return ! empty($success) ? true : false; |
|
229 | - } |
|
18 | + /** |
|
19 | + * @var EE_Event |
|
20 | + */ |
|
21 | + protected $_event; |
|
22 | + |
|
23 | + |
|
24 | + public function __construct(EE_Admin_Page $admin_page) |
|
25 | + { |
|
26 | + parent::__construct($admin_page); |
|
27 | + } |
|
28 | + |
|
29 | + |
|
30 | + protected function _set_hooks_properties() |
|
31 | + { |
|
32 | + |
|
33 | + $this->_name = 'venues'; |
|
34 | + |
|
35 | + if (EE_Config::instance()->admin->useAdvancedEditor()) { |
|
36 | + $this->_metaboxes = []; |
|
37 | + $this->_scripts_styles = []; |
|
38 | + return; |
|
39 | + } |
|
40 | + $this->_metaboxes = array( |
|
41 | + 0 => array( |
|
42 | + 'page_route' => array('edit', 'create_new'), |
|
43 | + 'func' => 'venue_metabox', |
|
44 | + 'label' => __('Venue Details', 'event_espresso'), |
|
45 | + 'priority' => 'high', |
|
46 | + 'context' => 'normal', |
|
47 | + ), |
|
48 | + ); |
|
49 | + |
|
50 | + $this->_scripts_styles = array( |
|
51 | + 'registers' => array( |
|
52 | + 'ee_event_venues' => array( |
|
53 | + 'type' => 'js', |
|
54 | + 'url' => EE_VENUES_ASSETS_URL . 'ee-event-venues-admin.js', |
|
55 | + 'depends' => array('jquery'), |
|
56 | + ), |
|
57 | + 'ee_event_venues_css' => array( |
|
58 | + 'type' => 'css', |
|
59 | + 'url' => EE_VENUES_ASSETS_URL . 'ee-event-venues-admin.css', |
|
60 | + ), |
|
61 | + ), |
|
62 | + 'enqueues' => array( |
|
63 | + 'ee_event_venues' => array('edit', 'create_new'), |
|
64 | + 'ee_event_venues_css' => array('edit', 'create_new'), |
|
65 | + ), |
|
66 | + ); |
|
67 | + |
|
68 | + // hook into the handler for saving venue |
|
69 | + add_filter( |
|
70 | + 'FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', |
|
71 | + array($this, 'modify_callbacks'), |
|
72 | + 10 |
|
73 | + ); |
|
74 | + |
|
75 | + // remove default ee_autosave returns for DECAF venues (not needed for CAF venues cause we have a dropdown selector) |
|
76 | + add_filter('FHEE__Events_Admin_Page__ee_autosave_edit_do_decaf_venue_save', '__return_false'); |
|
77 | + } |
|
78 | + |
|
79 | + |
|
80 | + public function modify_callbacks($callbacks) |
|
81 | + { |
|
82 | + // first remove default venue callback |
|
83 | + foreach ($callbacks as $key => $callback) { |
|
84 | + if ($callback[1] == '_default_venue_update') { |
|
85 | + unset($callbacks[ $key ]); |
|
86 | + } |
|
87 | + } |
|
88 | + |
|
89 | + // now let's add the caf version |
|
90 | + $callbacks[] = array($this, 'caf_venue_update'); |
|
91 | + return $callbacks; |
|
92 | + } |
|
93 | + |
|
94 | + |
|
95 | + public function venue_metabox() |
|
96 | + { |
|
97 | + $evt_obj = $this->_adminpage_obj->get_event_object(); |
|
98 | + $evt_id = $evt_obj->ID(); |
|
99 | + |
|
100 | + // first let's see if we have a venue already |
|
101 | + $evt_venues = ! empty($evt_id) ? $evt_obj->venues() : array(); |
|
102 | + $evt_venue = $evt_venues && is_array($evt_venues) ? reset($evt_venues) : null; |
|
103 | + $evt_venue_id = $evt_venue instanceof EE_Venue ? $evt_venue->ID() : null; |
|
104 | + |
|
105 | + // possibly private venues. |
|
106 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_private_venues', 'get_venues')) { |
|
107 | + $vnu_where['status'] = array('IN', array('publish', 'private')); |
|
108 | + } else { |
|
109 | + $vnu_where['status'] = 'publish'; |
|
110 | + } |
|
111 | + |
|
112 | + // cap checks |
|
113 | + if (! EE_Registry::instance()->CAP->current_user_can('ee_read_others_venues', 'get_venues')) { |
|
114 | + $vnu_where['VNU_wp_user'] = get_current_user_id(); |
|
115 | + } |
|
116 | + |
|
117 | + $vnumdl = EE_Registry::instance()->load_model('Venue'); |
|
118 | + $venues = $vnumdl->get_all(array($vnu_where, 'order_by' => array('VNU_name' => 'ASC'))); |
|
119 | + |
|
120 | + $ven_select = array(); |
|
121 | + $ven_select[0] = __('Select a Venue', 'event_espresso'); |
|
122 | + // setup venues for selector |
|
123 | + foreach ($venues as $venue) { |
|
124 | + $ven_select[ $venue->ID() ] = $venue->name(); |
|
125 | + } |
|
126 | + |
|
127 | + // if $ven_select does not have the existing venue attached to event then let's add that because we'll always |
|
128 | + // show existing attached venues even if it's trashed (or some other restricted status). |
|
129 | + |
|
130 | + if ($evt_venue_id && ! isset($ven_select[ $evt_venue_id ])) { |
|
131 | + $ven_select[ $evt_venue_id ] = $evt_venue->name(); |
|
132 | + $venues = array_merge($venues, array($evt_venue)); |
|
133 | + } |
|
134 | + |
|
135 | + $template_args['venues'] = $venues; |
|
136 | + $template_args['evt_venue_id'] = $evt_venue_id; |
|
137 | + $venue_selector = new EE_Select_Input( |
|
138 | + $ven_select, |
|
139 | + array( |
|
140 | + 'html_name' => 'venue_id', |
|
141 | + 'html_id' => 'venue_id', |
|
142 | + 'html_class' => 'wide', |
|
143 | + 'default' => $evt_venue_id ? $evt_venue_id : '0' |
|
144 | + ) |
|
145 | + ); |
|
146 | + $template_args['venue_selector'] = $venue_selector->get_html_for_input(); |
|
147 | + $enable_for_gmap = new EE_Yes_No_Input( |
|
148 | + array( |
|
149 | + 'html_name' => 'enable_for_gmap', |
|
150 | + 'html_id' => 'enable_for_gmap', |
|
151 | + 'default' => $evt_venue instanceof EE_Venue ? $evt_venue->enable_for_gmap() : false |
|
152 | + ) |
|
153 | + ); |
|
154 | + $template_args['enable_for_gmap'] = $enable_for_gmap->get_html_for_input(); |
|
155 | + $template_args['new_venue_link'] = EEH_HTML::link( |
|
156 | + EE_Admin_Page::add_query_args_and_nonce( |
|
157 | + array('action' => 'create_new'), |
|
158 | + EE_VENUES_ADMIN_URL |
|
159 | + ), |
|
160 | + esc_html_x('Add new Venue', 'a link to add a new venue', 'event_espresso'), |
|
161 | + esc_html_x('Add new Venue', 'a link to add a new venue', 'event_espresso'), |
|
162 | + 'ev_new_venue_link', |
|
163 | + 'button', |
|
164 | + 'margin-left:10px;', |
|
165 | + 'target="_blank"' |
|
166 | + ); |
|
167 | + |
|
168 | + // Decide on an info text when there are no venues to display. |
|
169 | + $no_venues_info_txt = esc_html_x( |
|
170 | + 'You have not created any venues yet.', |
|
171 | + 'Information text displayed in the venues metabox when there are no venues to display', |
|
172 | + 'event_espresso' |
|
173 | + ); |
|
174 | + if (empty($venues)) { |
|
175 | + $unpublished_where = $vnu_where; |
|
176 | + $unpublished_where['status'] = 'draft'; |
|
177 | + $unpublished_venues = $vnumdl->get_all(array($unpublished_where, 'order_by' => array('VNU_name' => 'ASC'))); |
|
178 | + if (count($unpublished_venues) > 0) { |
|
179 | + $no_venues_info_txt = esc_html_x( |
|
180 | + // @codingStandardsIgnoreStart |
|
181 | + 'Use the link below to publish your venue through the venue editor so it appears here for selection.', |
|
182 | + // @codingStandardsIgnoreEnd |
|
183 | + 'Information text displayed in the venues metabox when there are no venues to display', |
|
184 | + 'event_espresso' |
|
185 | + ); |
|
186 | + } |
|
187 | + } |
|
188 | + $template_args['no_venues_info'] = EEH_HTML::p( |
|
189 | + EEH_HTML::strong($no_venues_info_txt), |
|
190 | + 'no_venues_info', |
|
191 | + 'info' |
|
192 | + ); |
|
193 | + |
|
194 | + $template_path = empty($venues) ? EE_VENUES_TEMPLATE_PATH . 'event_venues_metabox_content.template.php' |
|
195 | + : EE_VENUES_TEMPLATE_PATH . 'event_venues_metabox_content_from_manager.template.php'; |
|
196 | + |
|
197 | + // Allow events venue metabox template args filtering. |
|
198 | + $template_args = apply_filters( |
|
199 | + 'FHEE__espresso_events_Venues_Hooks___venue_metabox__template_args', |
|
200 | + $template_args, |
|
201 | + $template_path |
|
202 | + ); |
|
203 | + |
|
204 | + EEH_Template::display_template($template_path, $template_args); |
|
205 | + } |
|
206 | + |
|
207 | + |
|
208 | + public function caf_venue_update($evtobj, $data) |
|
209 | + { |
|
210 | + EE_Registry::instance()->load_model('Venue'); |
|
211 | + $venue_id = ! empty($data['venue_id']) ? $data['venue_id'] : null; |
|
212 | + |
|
213 | + |
|
214 | + // first let's check if the selected venue matches any existing venue attached to the event |
|
215 | + $evt_venue = $evtobj->venues(); |
|
216 | + $evt_venue = ! empty($evt_venue) ? array_shift($evt_venue) : null; |
|
217 | + |
|
218 | + if (! empty($evt_venue) && $evt_venue->ID() != $venue_id) { |
|
219 | + $evtobj->_remove_relation_to($evt_venue->ID(), 'Venue'); |
|
220 | + } |
|
221 | + |
|
222 | + if (empty($venue_id)) { |
|
223 | + return true; |
|
224 | + } //no venue to attach |
|
225 | + |
|
226 | + // this should take care of adding to revisions as well as main post object |
|
227 | + $success = $evtobj->_add_relation_to($venue_id, 'Venue'); |
|
228 | + return ! empty($success) ? true : false; |
|
229 | + } |
|
230 | 230 | } |
@@ -51,12 +51,12 @@ discard block |
||
51 | 51 | 'registers' => array( |
52 | 52 | 'ee_event_venues' => array( |
53 | 53 | 'type' => 'js', |
54 | - 'url' => EE_VENUES_ASSETS_URL . 'ee-event-venues-admin.js', |
|
54 | + 'url' => EE_VENUES_ASSETS_URL.'ee-event-venues-admin.js', |
|
55 | 55 | 'depends' => array('jquery'), |
56 | 56 | ), |
57 | 57 | 'ee_event_venues_css' => array( |
58 | 58 | 'type' => 'css', |
59 | - 'url' => EE_VENUES_ASSETS_URL . 'ee-event-venues-admin.css', |
|
59 | + 'url' => EE_VENUES_ASSETS_URL.'ee-event-venues-admin.css', |
|
60 | 60 | ), |
61 | 61 | ), |
62 | 62 | 'enqueues' => array( |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | // first remove default venue callback |
83 | 83 | foreach ($callbacks as $key => $callback) { |
84 | 84 | if ($callback[1] == '_default_venue_update') { |
85 | - unset($callbacks[ $key ]); |
|
85 | + unset($callbacks[$key]); |
|
86 | 86 | } |
87 | 87 | } |
88 | 88 | |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | } |
111 | 111 | |
112 | 112 | // cap checks |
113 | - if (! EE_Registry::instance()->CAP->current_user_can('ee_read_others_venues', 'get_venues')) { |
|
113 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_venues', 'get_venues')) { |
|
114 | 114 | $vnu_where['VNU_wp_user'] = get_current_user_id(); |
115 | 115 | } |
116 | 116 | |
@@ -121,14 +121,14 @@ discard block |
||
121 | 121 | $ven_select[0] = __('Select a Venue', 'event_espresso'); |
122 | 122 | // setup venues for selector |
123 | 123 | foreach ($venues as $venue) { |
124 | - $ven_select[ $venue->ID() ] = $venue->name(); |
|
124 | + $ven_select[$venue->ID()] = $venue->name(); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | // if $ven_select does not have the existing venue attached to event then let's add that because we'll always |
128 | 128 | // show existing attached venues even if it's trashed (or some other restricted status). |
129 | 129 | |
130 | - if ($evt_venue_id && ! isset($ven_select[ $evt_venue_id ])) { |
|
131 | - $ven_select[ $evt_venue_id ] = $evt_venue->name(); |
|
130 | + if ($evt_venue_id && ! isset($ven_select[$evt_venue_id])) { |
|
131 | + $ven_select[$evt_venue_id] = $evt_venue->name(); |
|
132 | 132 | $venues = array_merge($venues, array($evt_venue)); |
133 | 133 | } |
134 | 134 | |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | ); |
193 | 193 | |
194 | 194 | $template_path = empty($venues) ? EE_VENUES_TEMPLATE_PATH . 'event_venues_metabox_content.template.php' |
195 | - : EE_VENUES_TEMPLATE_PATH . 'event_venues_metabox_content_from_manager.template.php'; |
|
195 | + : EE_VENUES_TEMPLATE_PATH.'event_venues_metabox_content_from_manager.template.php'; |
|
196 | 196 | |
197 | 197 | // Allow events venue metabox template args filtering. |
198 | 198 | $template_args = apply_filters( |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | $evt_venue = $evtobj->venues(); |
216 | 216 | $evt_venue = ! empty($evt_venue) ? array_shift($evt_venue) : null; |
217 | 217 | |
218 | - if (! empty($evt_venue) && $evt_venue->ID() != $venue_id) { |
|
218 | + if ( ! empty($evt_venue) && $evt_venue->ID() != $venue_id) { |
|
219 | 219 | $evtobj->_remove_relation_to($evt_venue->ID(), 'Venue'); |
220 | 220 | } |
221 | 221 |