@@ -14,268 +14,268 @@ |
||
14 | 14 | class EED_Events_Archive_Caff extends EED_Events_Archive |
15 | 15 | { |
16 | 16 | |
17 | - /** |
|
18 | - * @return EED_Events_Archive_Caff|EED_Module |
|
19 | - */ |
|
20 | - public static function instance() |
|
21 | - { |
|
22 | - return parent::get_instance(__CLASS__); |
|
23 | - } |
|
17 | + /** |
|
18 | + * @return EED_Events_Archive_Caff|EED_Module |
|
19 | + */ |
|
20 | + public static function instance() |
|
21 | + { |
|
22 | + return parent::get_instance(__CLASS__); |
|
23 | + } |
|
24 | 24 | |
25 | 25 | |
26 | - /** |
|
27 | - * set_hooks - for hooking into EE Core, other modules, etc |
|
28 | - * |
|
29 | - * @return void |
|
30 | - */ |
|
31 | - public static function set_hooks() |
|
32 | - { |
|
33 | - } |
|
26 | + /** |
|
27 | + * set_hooks - for hooking into EE Core, other modules, etc |
|
28 | + * |
|
29 | + * @return void |
|
30 | + */ |
|
31 | + public static function set_hooks() |
|
32 | + { |
|
33 | + } |
|
34 | 34 | |
35 | - /** |
|
36 | - * set_hooks_admin - for hooking into EE Admin Core, other modules, etc |
|
37 | - * |
|
38 | - * @access public |
|
39 | - * @return void |
|
40 | - */ |
|
41 | - public static function set_hooks_admin() |
|
42 | - { |
|
43 | - self::setDefinitions(); |
|
44 | - add_action( |
|
45 | - 'AHEE__template_settings__template__before_settings_form', |
|
46 | - array('EED_Events_Archive_Caff', 'template_settings_form'), |
|
47 | - 10 |
|
48 | - ); |
|
49 | - add_filter( |
|
50 | - 'FHEE__General_Settings_Admin_Page__update_template_settings__data', |
|
51 | - array('EED_Events_Archive_Caff', 'update_template_settings'), |
|
52 | - 10, |
|
53 | - 2 |
|
54 | - ); |
|
55 | - // AJAX |
|
56 | - add_action( |
|
57 | - 'wp_ajax_espresso_update_event_archive_order', |
|
58 | - array('EED_Events_Archive_Caff', 'update_event_archive_order') |
|
59 | - ); |
|
60 | - add_action( |
|
61 | - 'wp_ajax_nopriv_espresso_update_event_archive_order', |
|
62 | - array('EED_Events_Archive_Caff', 'update_event_archive_order') |
|
63 | - ); |
|
64 | - } |
|
35 | + /** |
|
36 | + * set_hooks_admin - for hooking into EE Admin Core, other modules, etc |
|
37 | + * |
|
38 | + * @access public |
|
39 | + * @return void |
|
40 | + */ |
|
41 | + public static function set_hooks_admin() |
|
42 | + { |
|
43 | + self::setDefinitions(); |
|
44 | + add_action( |
|
45 | + 'AHEE__template_settings__template__before_settings_form', |
|
46 | + array('EED_Events_Archive_Caff', 'template_settings_form'), |
|
47 | + 10 |
|
48 | + ); |
|
49 | + add_filter( |
|
50 | + 'FHEE__General_Settings_Admin_Page__update_template_settings__data', |
|
51 | + array('EED_Events_Archive_Caff', 'update_template_settings'), |
|
52 | + 10, |
|
53 | + 2 |
|
54 | + ); |
|
55 | + // AJAX |
|
56 | + add_action( |
|
57 | + 'wp_ajax_espresso_update_event_archive_order', |
|
58 | + array('EED_Events_Archive_Caff', 'update_event_archive_order') |
|
59 | + ); |
|
60 | + add_action( |
|
61 | + 'wp_ajax_nopriv_espresso_update_event_archive_order', |
|
62 | + array('EED_Events_Archive_Caff', 'update_event_archive_order') |
|
63 | + ); |
|
64 | + } |
|
65 | 65 | |
66 | 66 | |
67 | - /** |
|
68 | - * run - initial module setup |
|
69 | - * |
|
70 | - * @param WP $WP |
|
71 | - * @return void |
|
72 | - */ |
|
73 | - public function run($WP) |
|
74 | - { |
|
75 | - } |
|
67 | + /** |
|
68 | + * run - initial module setup |
|
69 | + * |
|
70 | + * @param WP $WP |
|
71 | + * @return void |
|
72 | + */ |
|
73 | + public function run($WP) |
|
74 | + { |
|
75 | + } |
|
76 | 76 | |
77 | 77 | |
78 | - /** |
|
79 | - * Conditionally set constants if they haven't been defined yet. |
|
80 | - */ |
|
81 | - public static function setDefinitions() |
|
82 | - { |
|
83 | - if (! defined('EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH')) { |
|
84 | - define( |
|
85 | - 'EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH', |
|
86 | - str_replace('\\', DS, plugin_dir_path(__FILE__)) . 'templates/' |
|
87 | - ); |
|
88 | - define('EVENT_ARCHIVE_CAFF_ASSETS_URL', plugin_dir_url(__FILE__) . 'assets/'); |
|
89 | - } |
|
90 | - } |
|
78 | + /** |
|
79 | + * Conditionally set constants if they haven't been defined yet. |
|
80 | + */ |
|
81 | + public static function setDefinitions() |
|
82 | + { |
|
83 | + if (! defined('EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH')) { |
|
84 | + define( |
|
85 | + 'EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH', |
|
86 | + str_replace('\\', DS, plugin_dir_path(__FILE__)) . 'templates/' |
|
87 | + ); |
|
88 | + define('EVENT_ARCHIVE_CAFF_ASSETS_URL', plugin_dir_url(__FILE__) . 'assets/'); |
|
89 | + } |
|
90 | + } |
|
91 | 91 | |
92 | 92 | |
93 | - /** |
|
94 | - * @return void |
|
95 | - * @throws DomainException |
|
96 | - * @throws InvalidArgumentException |
|
97 | - * @throws InvalidDataTypeException |
|
98 | - * @throws InvalidInterfaceException |
|
99 | - */ |
|
100 | - public static function template_settings_form() |
|
101 | - { |
|
102 | - /** @var EE_Admin_Page_Loader $admin_page_loader */ |
|
103 | - $admin_page_loader = LoaderFactory::getLoader()->getShared('EE_Admin_Page_Loader'); |
|
104 | - // grab general settings admin page and remove the existing hook callback |
|
105 | - $gen_set_admin = $admin_page_loader->get_admin_page_object('general_settings'); |
|
106 | - if ($gen_set_admin instanceof General_Settings_Admin_Page) { |
|
107 | - remove_action( |
|
108 | - 'AHEE__template_settings__template__before_settings_form', |
|
109 | - array($gen_set_admin, 'template_settings_caff_features'), |
|
110 | - 100 |
|
111 | - ); |
|
112 | - } |
|
113 | - // first just grab the template settings |
|
114 | - $config = EE_Registry::instance()->CFG->template_settings; |
|
115 | - // then if the Event Archive config is valid, use that, else create a new one |
|
116 | - $config = $config instanceof EE_Template_Config |
|
117 | - && $config->EED_Events_Archive instanceof EE_Events_Archive_Config |
|
118 | - ? $config->EED_Events_Archive |
|
119 | - : new EE_Events_Archive_Config(); |
|
120 | - $config = apply_filters( |
|
121 | - 'FHEE__EED_Events_Archive__template_settings_form__event_list_config', |
|
122 | - $config |
|
123 | - ); |
|
124 | - $config->display_status_banner = isset($config->display_status_banner) |
|
125 | - ? $config->display_status_banner |
|
126 | - : 0; |
|
127 | - $config->display_description = isset($config->display_description) |
|
128 | - ? $config->display_description |
|
129 | - : 1; |
|
130 | - $config->display_ticket_selector = isset($config->display_ticket_selector) |
|
131 | - ? $config->display_ticket_selector |
|
132 | - : 0; |
|
133 | - $config->display_datetimes = isset($config->display_datetimes) |
|
134 | - ? $config->display_datetimes |
|
135 | - : 1; |
|
136 | - $config->display_venue = isset($config->display_venue) |
|
137 | - ? $config->display_venue |
|
138 | - : 0; |
|
139 | - $config->display_expired_events = isset($config->display_expired_events) |
|
140 | - ? $config->display_expired_events |
|
141 | - : 0; |
|
142 | - // display order options |
|
143 | - $config->use_sortable_display_order = isset($config->use_sortable_display_order) |
|
144 | - ? $config->use_sortable_display_order |
|
145 | - : false; |
|
146 | - $config->display_order_tickets = isset($config->display_order_tickets) |
|
147 | - ? $config->display_order_tickets |
|
148 | - : 120; |
|
149 | - $config->display_order_datetimes = isset($config->display_order_datetimes) |
|
150 | - ? $config->display_order_datetimes |
|
151 | - : 110; |
|
152 | - $config->display_order_event = isset($config->display_order_event) |
|
153 | - ? $config->display_order_event |
|
154 | - : 100; |
|
155 | - $config->display_order_venue = isset($config->display_order_venue) |
|
156 | - ? $config->display_order_venue |
|
157 | - : 130; |
|
158 | - // get template parts |
|
159 | - $template_parts = EED_Events_Archive::instance()->initialize_template_parts($config); |
|
160 | - // convert to array so that we can add more properties |
|
161 | - $config = get_object_vars($config); |
|
162 | - $config['event_archive_display_order'] = $template_parts->generate_sortable_list_of_template_parts( |
|
163 | - 'event-archive-sortable-js', |
|
164 | - '', |
|
165 | - 'archive-sortable-li archive-sortable-js' |
|
166 | - ); |
|
167 | - EEH_Template::display_template( |
|
168 | - EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH . 'admin-event-list-settings.template.php', |
|
169 | - $config |
|
170 | - ); |
|
171 | - } |
|
93 | + /** |
|
94 | + * @return void |
|
95 | + * @throws DomainException |
|
96 | + * @throws InvalidArgumentException |
|
97 | + * @throws InvalidDataTypeException |
|
98 | + * @throws InvalidInterfaceException |
|
99 | + */ |
|
100 | + public static function template_settings_form() |
|
101 | + { |
|
102 | + /** @var EE_Admin_Page_Loader $admin_page_loader */ |
|
103 | + $admin_page_loader = LoaderFactory::getLoader()->getShared('EE_Admin_Page_Loader'); |
|
104 | + // grab general settings admin page and remove the existing hook callback |
|
105 | + $gen_set_admin = $admin_page_loader->get_admin_page_object('general_settings'); |
|
106 | + if ($gen_set_admin instanceof General_Settings_Admin_Page) { |
|
107 | + remove_action( |
|
108 | + 'AHEE__template_settings__template__before_settings_form', |
|
109 | + array($gen_set_admin, 'template_settings_caff_features'), |
|
110 | + 100 |
|
111 | + ); |
|
112 | + } |
|
113 | + // first just grab the template settings |
|
114 | + $config = EE_Registry::instance()->CFG->template_settings; |
|
115 | + // then if the Event Archive config is valid, use that, else create a new one |
|
116 | + $config = $config instanceof EE_Template_Config |
|
117 | + && $config->EED_Events_Archive instanceof EE_Events_Archive_Config |
|
118 | + ? $config->EED_Events_Archive |
|
119 | + : new EE_Events_Archive_Config(); |
|
120 | + $config = apply_filters( |
|
121 | + 'FHEE__EED_Events_Archive__template_settings_form__event_list_config', |
|
122 | + $config |
|
123 | + ); |
|
124 | + $config->display_status_banner = isset($config->display_status_banner) |
|
125 | + ? $config->display_status_banner |
|
126 | + : 0; |
|
127 | + $config->display_description = isset($config->display_description) |
|
128 | + ? $config->display_description |
|
129 | + : 1; |
|
130 | + $config->display_ticket_selector = isset($config->display_ticket_selector) |
|
131 | + ? $config->display_ticket_selector |
|
132 | + : 0; |
|
133 | + $config->display_datetimes = isset($config->display_datetimes) |
|
134 | + ? $config->display_datetimes |
|
135 | + : 1; |
|
136 | + $config->display_venue = isset($config->display_venue) |
|
137 | + ? $config->display_venue |
|
138 | + : 0; |
|
139 | + $config->display_expired_events = isset($config->display_expired_events) |
|
140 | + ? $config->display_expired_events |
|
141 | + : 0; |
|
142 | + // display order options |
|
143 | + $config->use_sortable_display_order = isset($config->use_sortable_display_order) |
|
144 | + ? $config->use_sortable_display_order |
|
145 | + : false; |
|
146 | + $config->display_order_tickets = isset($config->display_order_tickets) |
|
147 | + ? $config->display_order_tickets |
|
148 | + : 120; |
|
149 | + $config->display_order_datetimes = isset($config->display_order_datetimes) |
|
150 | + ? $config->display_order_datetimes |
|
151 | + : 110; |
|
152 | + $config->display_order_event = isset($config->display_order_event) |
|
153 | + ? $config->display_order_event |
|
154 | + : 100; |
|
155 | + $config->display_order_venue = isset($config->display_order_venue) |
|
156 | + ? $config->display_order_venue |
|
157 | + : 130; |
|
158 | + // get template parts |
|
159 | + $template_parts = EED_Events_Archive::instance()->initialize_template_parts($config); |
|
160 | + // convert to array so that we can add more properties |
|
161 | + $config = get_object_vars($config); |
|
162 | + $config['event_archive_display_order'] = $template_parts->generate_sortable_list_of_template_parts( |
|
163 | + 'event-archive-sortable-js', |
|
164 | + '', |
|
165 | + 'archive-sortable-li archive-sortable-js' |
|
166 | + ); |
|
167 | + EEH_Template::display_template( |
|
168 | + EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH . 'admin-event-list-settings.template.php', |
|
169 | + $config |
|
170 | + ); |
|
171 | + } |
|
172 | 172 | |
173 | 173 | |
174 | - /** |
|
175 | - * @param EE_Template_Config $CFG |
|
176 | - * @param array $REQ |
|
177 | - * @return EE_Template_Config |
|
178 | - */ |
|
179 | - public static function update_template_settings($CFG, $REQ) |
|
180 | - { |
|
181 | - // unless we are resetting the config... |
|
182 | - if ( |
|
183 | - ! isset($REQ['EED_Events_Archive_reset_event_list_settings']) |
|
184 | - || absint($REQ['EED_Events_Archive_reset_event_list_settings']) !== 1 |
|
185 | - ) { |
|
186 | - /** @var EE_Events_Archive_Config $config */ |
|
187 | - $config = $CFG->EED_Events_Archive instanceof EE_Events_Archive_Config |
|
188 | - ? $CFG->EED_Events_Archive |
|
189 | - : new EE_Events_Archive_Config(); |
|
174 | + /** |
|
175 | + * @param EE_Template_Config $CFG |
|
176 | + * @param array $REQ |
|
177 | + * @return EE_Template_Config |
|
178 | + */ |
|
179 | + public static function update_template_settings($CFG, $REQ) |
|
180 | + { |
|
181 | + // unless we are resetting the config... |
|
182 | + if ( |
|
183 | + ! isset($REQ['EED_Events_Archive_reset_event_list_settings']) |
|
184 | + || absint($REQ['EED_Events_Archive_reset_event_list_settings']) !== 1 |
|
185 | + ) { |
|
186 | + /** @var EE_Events_Archive_Config $config */ |
|
187 | + $config = $CFG->EED_Events_Archive instanceof EE_Events_Archive_Config |
|
188 | + ? $CFG->EED_Events_Archive |
|
189 | + : new EE_Events_Archive_Config(); |
|
190 | 190 | |
191 | - $config->display_status_banner = isset($REQ['EED_Events_Archive_display_status_banner']) |
|
192 | - ? absint($REQ['EED_Events_Archive_display_status_banner']) |
|
193 | - : 0; |
|
194 | - $config->display_description = isset($REQ['EED_Events_Archive_display_description']) |
|
195 | - ? absint($REQ['EED_Events_Archive_display_description']) |
|
196 | - : 1; |
|
197 | - $config->display_ticket_selector = isset($REQ['EED_Events_Archive_display_ticket_selector']) |
|
198 | - ? absint($REQ['EED_Events_Archive_display_ticket_selector']) |
|
199 | - : 0; |
|
200 | - $config->display_datetimes = isset($REQ['EED_Events_Archive_display_datetimes']) |
|
201 | - ? absint($REQ['EED_Events_Archive_display_datetimes']) |
|
202 | - : 1; |
|
203 | - $config->display_venue = isset($REQ['EED_Events_Archive_display_venue']) |
|
204 | - ? absint($REQ['EED_Events_Archive_display_venue']) |
|
205 | - : 0; |
|
206 | - $config->display_expired_events = isset($REQ['EED_Events_Archive_display_expired_events']) |
|
207 | - ? absint($REQ['EED_Events_Archive_display_expired_events']) |
|
208 | - : 0; |
|
209 | - $config->use_sortable_display_order = isset($REQ['EED_Events_Archive_use_sortable_display_order']) |
|
210 | - ? absint($REQ['EED_Events_Archive_use_sortable_display_order']) |
|
211 | - : 0; |
|
212 | - $config->display_order_event = $config->display_order_event !== null |
|
213 | - && $config->use_sortable_display_order |
|
214 | - ? $config->display_order_event |
|
215 | - : EED_Events_Archive::EVENT_DETAILS_PRIORITY; |
|
216 | - $config->display_order_datetimes = $config->display_order_datetimes !== null |
|
217 | - && $config->use_sortable_display_order |
|
218 | - ? $config->display_order_datetimes |
|
219 | - : EED_Events_Archive::EVENT_DATETIMES_PRIORITY; |
|
220 | - $config->display_order_tickets = $config->display_order_tickets !== null |
|
221 | - && $config->use_sortable_display_order |
|
222 | - ? $config->display_order_tickets |
|
223 | - : EED_Events_Archive::EVENT_TICKETS_PRIORITY; |
|
224 | - $config->display_order_venue = $config->display_order_venue !== null |
|
225 | - && $config->use_sortable_display_order |
|
226 | - ? $config->display_order_venue |
|
227 | - : EED_Events_Archive::EVENT_VENUES_PRIORITY; |
|
228 | - } else { |
|
229 | - $config = new EE_Events_Archive_Config(); |
|
230 | - } |
|
191 | + $config->display_status_banner = isset($REQ['EED_Events_Archive_display_status_banner']) |
|
192 | + ? absint($REQ['EED_Events_Archive_display_status_banner']) |
|
193 | + : 0; |
|
194 | + $config->display_description = isset($REQ['EED_Events_Archive_display_description']) |
|
195 | + ? absint($REQ['EED_Events_Archive_display_description']) |
|
196 | + : 1; |
|
197 | + $config->display_ticket_selector = isset($REQ['EED_Events_Archive_display_ticket_selector']) |
|
198 | + ? absint($REQ['EED_Events_Archive_display_ticket_selector']) |
|
199 | + : 0; |
|
200 | + $config->display_datetimes = isset($REQ['EED_Events_Archive_display_datetimes']) |
|
201 | + ? absint($REQ['EED_Events_Archive_display_datetimes']) |
|
202 | + : 1; |
|
203 | + $config->display_venue = isset($REQ['EED_Events_Archive_display_venue']) |
|
204 | + ? absint($REQ['EED_Events_Archive_display_venue']) |
|
205 | + : 0; |
|
206 | + $config->display_expired_events = isset($REQ['EED_Events_Archive_display_expired_events']) |
|
207 | + ? absint($REQ['EED_Events_Archive_display_expired_events']) |
|
208 | + : 0; |
|
209 | + $config->use_sortable_display_order = isset($REQ['EED_Events_Archive_use_sortable_display_order']) |
|
210 | + ? absint($REQ['EED_Events_Archive_use_sortable_display_order']) |
|
211 | + : 0; |
|
212 | + $config->display_order_event = $config->display_order_event !== null |
|
213 | + && $config->use_sortable_display_order |
|
214 | + ? $config->display_order_event |
|
215 | + : EED_Events_Archive::EVENT_DETAILS_PRIORITY; |
|
216 | + $config->display_order_datetimes = $config->display_order_datetimes !== null |
|
217 | + && $config->use_sortable_display_order |
|
218 | + ? $config->display_order_datetimes |
|
219 | + : EED_Events_Archive::EVENT_DATETIMES_PRIORITY; |
|
220 | + $config->display_order_tickets = $config->display_order_tickets !== null |
|
221 | + && $config->use_sortable_display_order |
|
222 | + ? $config->display_order_tickets |
|
223 | + : EED_Events_Archive::EVENT_TICKETS_PRIORITY; |
|
224 | + $config->display_order_venue = $config->display_order_venue !== null |
|
225 | + && $config->use_sortable_display_order |
|
226 | + ? $config->display_order_venue |
|
227 | + : EED_Events_Archive::EVENT_VENUES_PRIORITY; |
|
228 | + } else { |
|
229 | + $config = new EE_Events_Archive_Config(); |
|
230 | + } |
|
231 | 231 | |
232 | - $CFG->EED_Events_Archive = $config; |
|
233 | - do_action('AHEE__EED_Events_Archive__update_template_settings__after_update', $CFG, $REQ); |
|
234 | - return $CFG; |
|
235 | - } |
|
232 | + $CFG->EED_Events_Archive = $config; |
|
233 | + do_action('AHEE__EED_Events_Archive__update_template_settings__after_update', $CFG, $REQ); |
|
234 | + return $CFG; |
|
235 | + } |
|
236 | 236 | |
237 | 237 | |
238 | - /** |
|
239 | - * @return void |
|
240 | - * @throws InvalidArgumentException |
|
241 | - * @throws InvalidDataTypeException |
|
242 | - * @throws InvalidInterfaceException |
|
243 | - */ |
|
244 | - public static function update_event_archive_order() |
|
245 | - { |
|
246 | - /** @var EE_Config $config */ |
|
247 | - $config = EE_Registry::instance()->CFG; |
|
248 | - $config_saved = false; |
|
249 | - $template_parts = EED_Events_Archive_Caff::getRequest()->getRequestParam('elements'); |
|
250 | - if (! empty($template_parts)) { |
|
251 | - $template_parts = explode(',', trim($template_parts, ',')); |
|
252 | - foreach ($template_parts as $key => $template_part) { |
|
253 | - $template_part = "display_order_$template_part"; |
|
254 | - $priority = ($key * 10) + EED_Events_Archive::EVENT_DETAILS_PRIORITY; |
|
255 | - if ( |
|
256 | - $config->template_settings->EED_Events_Archive instanceof EE_Events_Archive_Config |
|
257 | - && property_exists( |
|
258 | - $config->template_settings->EED_Events_Archive, |
|
259 | - $template_part |
|
260 | - ) |
|
261 | - ) { |
|
262 | - $config->template_settings->EED_Events_Archive->{$template_part} = $priority; |
|
263 | - } |
|
264 | - do_action("AHEE__EED_Events_Archive__update_event_archive_order__$template_part", $priority); |
|
265 | - } |
|
266 | - $config_saved = $config->update_espresso_config(false, false); |
|
267 | - } |
|
268 | - if ($config_saved) { |
|
269 | - EE_Error::add_success(esc_html__('Display Order has been successfully updated.', 'event_espresso')); |
|
270 | - } else { |
|
271 | - EE_Error::add_error( |
|
272 | - esc_html__('Display Order was not updated.', 'event_espresso'), |
|
273 | - __FILE__, |
|
274 | - __FUNCTION__, |
|
275 | - __LINE__ |
|
276 | - ); |
|
277 | - } |
|
278 | - echo wp_json_encode(EE_Error::get_notices(false)); |
|
279 | - exit(); |
|
280 | - } |
|
238 | + /** |
|
239 | + * @return void |
|
240 | + * @throws InvalidArgumentException |
|
241 | + * @throws InvalidDataTypeException |
|
242 | + * @throws InvalidInterfaceException |
|
243 | + */ |
|
244 | + public static function update_event_archive_order() |
|
245 | + { |
|
246 | + /** @var EE_Config $config */ |
|
247 | + $config = EE_Registry::instance()->CFG; |
|
248 | + $config_saved = false; |
|
249 | + $template_parts = EED_Events_Archive_Caff::getRequest()->getRequestParam('elements'); |
|
250 | + if (! empty($template_parts)) { |
|
251 | + $template_parts = explode(',', trim($template_parts, ',')); |
|
252 | + foreach ($template_parts as $key => $template_part) { |
|
253 | + $template_part = "display_order_$template_part"; |
|
254 | + $priority = ($key * 10) + EED_Events_Archive::EVENT_DETAILS_PRIORITY; |
|
255 | + if ( |
|
256 | + $config->template_settings->EED_Events_Archive instanceof EE_Events_Archive_Config |
|
257 | + && property_exists( |
|
258 | + $config->template_settings->EED_Events_Archive, |
|
259 | + $template_part |
|
260 | + ) |
|
261 | + ) { |
|
262 | + $config->template_settings->EED_Events_Archive->{$template_part} = $priority; |
|
263 | + } |
|
264 | + do_action("AHEE__EED_Events_Archive__update_event_archive_order__$template_part", $priority); |
|
265 | + } |
|
266 | + $config_saved = $config->update_espresso_config(false, false); |
|
267 | + } |
|
268 | + if ($config_saved) { |
|
269 | + EE_Error::add_success(esc_html__('Display Order has been successfully updated.', 'event_espresso')); |
|
270 | + } else { |
|
271 | + EE_Error::add_error( |
|
272 | + esc_html__('Display Order was not updated.', 'event_espresso'), |
|
273 | + __FILE__, |
|
274 | + __FUNCTION__, |
|
275 | + __LINE__ |
|
276 | + ); |
|
277 | + } |
|
278 | + echo wp_json_encode(EE_Error::get_notices(false)); |
|
279 | + exit(); |
|
280 | + } |
|
281 | 281 | } |