PluginProbe
aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder / 2.14.0
aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder v2.14.0
2.14.0 2.13.0 2.13.1 2.12.0 2.11.1 2.11.0 2.10.0 2.9.0 2.7.4 2.7.5 2.7.6 2.7.7 2.8.0 2.8.1 2.9.1 trunk 1.0 1.0-beta1 1.0-beta2 1.0-beta3 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 All 81 releases
← All changes | includes/blocks/academy-course-reviews/block.php +452 -0 2.7.7 → 2.14.0 View file →
@@ -1,0 +1,452 @@
1 +<?php
2 +namespace ABlocks\Blocks\AcademyCourseReviews;
3 +
4 +if ( ! defined( 'ABSPATH' ) ) {
5 + exit;
6 +}
7 +
8 +use ABlocks\Classes\BlockBaseAbstract;
9 +use ABlocks\Classes\CssGenerator;
10 +use ABlocks\Classes\CssGeneratorV2;
11 +use ABlocks\Helper;
12 +use ABlocks\Controls\Typography;
13 +use ABlocks\Controls\Background;
14 +use ABlocks\Controls\Border;
15 +use ABlocks\Controls\Dimensions;
16 +use ABlocks\Controls\Range;
17 +use ABlocks\Controls\BoxShadow;
18 +use ABlocks\Controls\Color;
19 +
20 +
21 +class Block extends BlockBaseAbstract {
22 + protected $block_name = 'academy-course-reviews';
23 +
24 + public function build_css( $attributes ) {
25 + $css_generator = new CssGeneratorV2( $attributes, $this->block_name );
26 +
27 + $css_generator->add_class_styles(
28 + '{{WRAPPER}} .academy-single-course__content-item--feedback .feedback-title',
29 + $this->get_feedback_heading_css( $attributes ),
30 + $this->get_feedback_heading_css( $attributes, 'Tablet' ),
31 + $this->get_feedback_heading_css( $attributes, 'Mobile' ),
32 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_feedback_heading_css( $attributes, $device ); } )
33 + );
34 + $css_generator->add_class_styles(
35 + '{{WRAPPER}} .academy-single-course__content-item--feedback .feedback-title:hover',
36 + $this->get_feedback_heading_hover_css( $attributes ),
37 + $this->get_feedback_heading_hover_css( $attributes, 'Tablet' ),
38 + $this->get_feedback_heading_hover_css( $attributes, 'Mobile' ),
39 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_feedback_heading_hover_css( $attributes, $device ); } )
40 + );
41 + $css_generator->add_class_styles(
42 + '{{WRAPPER}} .academy-single-course__content-item--feedback .academy-student-course-feedback-ratings',
43 + $this->get_feedback_section_css( $attributes ),
44 + $this->get_feedback_section_css( $attributes, 'Tablet' ),
45 + $this->get_feedback_section_css( $attributes, 'Mobile' ),
46 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_feedback_section_css( $attributes, $device ); } )
47 + );
48 + $css_generator->add_class_styles(
49 + '{{WRAPPER}} .academy-single-course__content-item--feedback .academy-student-course-feedback-ratings:hover',
50 + $this->get_feedback_section_hover_css( $attributes ),
51 + $this->get_feedback_section_hover_css( $attributes, 'Tablet' ),
52 + $this->get_feedback_section_hover_css( $attributes, 'Mobile' ),
53 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_feedback_section_hover_css( $attributes, $device ); } )
54 + );
55 + $css_generator->add_class_styles(
56 + '{{WRAPPER}} .academy-single-course__content-item--feedback .academy-student-course-feedback-ratings .academy-avg-rating',
57 + $this->get_avg_rating_css( $attributes ),
58 + $this->get_avg_rating_css( $attributes, 'Tablet' ),
59 + $this->get_avg_rating_css( $attributes, 'Mobile' ),
60 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_avg_rating_css( $attributes, $device ); } )
61 + );
62 + $css_generator->add_class_styles(
63 + '{{WRAPPER}} .academy-single-course__content-item--feedback .academy-student-course-feedback-ratings .academy-avg-rating:hover',
64 + $this->get_avg_rating_hover_css( $attributes, '' ),
65 + $this->get_avg_rating_hover_css( $attributes, 'Tablet' ),
66 + $this->get_avg_rating_hover_css( $attributes, 'Mobile' ),
67 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_avg_rating_hover_css( $attributes, $device ); } )
68 + );
69 + $css_generator->add_class_styles(
70 + '{{WRAPPER}} .academy-single-course__content-item--feedback .academy-student-course-feedback-ratings .academy-avg-rating-html .academy-icon::before',
71 + $this->get_rating_star_css( $attributes ),
72 + $this->get_rating_star_css( $attributes, 'Tablet' ),
73 + $this->get_rating_star_css( $attributes, 'Mobile' ),
74 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_rating_star_css( $attributes, $device ); } )
75 + );
76 + $css_generator->add_class_styles(
77 + '{{WRAPPER}} .academy-single-course__content-item--feedback .academy-student-course-feedback-ratings .academy-avg-rating-html .academy-icon:hover::before',
78 + $this->get_rating_star_hover_css( $attributes, '' ),
79 + $this->get_rating_star_hover_css( $attributes, 'Tablet' ),
80 + $this->get_rating_star_hover_css( $attributes, 'Mobile' ),
81 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_rating_star_hover_css( $attributes, $device ); } )
82 + );
83 + $css_generator->add_class_styles(
84 + '{{WRAPPER}} .academy-single-course__content-item--feedback .academy-student-course-feedback-ratings .academy-avg-rating-total',
85 + $this->get_total_rating_css( $attributes, '' ),
86 + $this->get_total_rating_css( $attributes, 'Tablet' ),
87 + $this->get_total_rating_css( $attributes, 'Mobile' ),
88 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_total_rating_css( $attributes, $device ); } )
89 + );
90 + $css_generator->add_class_styles(
91 + '{{WRAPPER}} .academy-single-course__content-item--feedback .academy-student-course-feedback-ratings .academy-avg-rating-total:hover',
92 + $this->get_total_rating_hover_css( $attributes, '' ),
93 + $this->get_total_rating_hover_css( $attributes, 'Tablet' ),
94 + $this->get_total_rating_hover_css( $attributes, 'Mobile' ),
95 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_total_rating_hover_css( $attributes, $device ); } )
96 + );
97 + $css_generator->add_class_styles(
98 + '{{WRAPPER}} .academy-single-course__content-item--feedback .academy-student-course-feedback-ratings .academy-ratings-list-item .academy-ratings-list-item-col,
99 + {{WRAPPER}} .academy-single-course__content-item--feedback .academy-student-course-feedback-ratings .academy-ratings-list-item .academy-ratings-list-item-label,
100 + {{WRAPPER}} .academy-single-course__content-item--feedback .academy-student-course-feedback-ratings .academy-ratings-list-item .academy-ratings-list-item-label span',
101 + $this->get_feedback_css( $attributes, '' ),
102 + $this->get_feedback_css( $attributes, 'Tablet' ),
103 + $this->get_feedback_css( $attributes, 'Mobile' ),
104 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_feedback_css( $attributes, $device ); } )
105 + );
106 + $css_generator->add_class_styles(
107 + '{{WRAPPER}} .academy-single-course__content-item--feedback .academy-student-course-feedback-ratings .academy-ratings-list-item .academy-ratings-list-item-col:hover,
108 + {{WRAPPER}} .academy-single-course__content-item--feedback .academy-student-course-feedback-ratings .academy-ratings-list-item .academy-ratings-list-item-label:hover,
109 + {{WRAPPER}} .academy-single-course__content-item--feedback .academy-student-course-feedback-ratings .academy-ratings-list-item .academy-ratings-list-item-label span:hover',
110 + $this->get_feedback_hover_css( $attributes, '' ),
111 + $this->get_feedback_hover_css( $attributes, 'Tablet' ),
112 + $this->get_feedback_hover_css( $attributes, 'Mobile' ),
113 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_feedback_hover_css( $attributes, $device ); } )
114 + );
115 + $css_generator->add_class_styles(
116 + '{{WRAPPER}} .academy-single-course__content-item--feedback .academy-student-course-feedback-ratings .academy-ratings-list-item .academy-icon',
117 + $this->get_start_css( $attributes, '' ),
118 + $this->get_start_css( $attributes, 'Tablet' ),
119 + $this->get_start_css( $attributes, 'Mobile' ),
120 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_start_css( $attributes, $device ); } )
121 + );
122 + $css_generator->add_class_styles(
123 + '{{WRAPPER}} .academy-single-course__content-item--feedback .academy-student-course-feedback-ratings .academy-ratings-list-item .academy-icon:hover',
124 + $this->get_start_hover_css( $attributes, '' ),
125 + $this->get_start_hover_css( $attributes, 'Tablet' ),
126 + $this->get_start_hover_css( $attributes, 'Mobile' ),
127 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_start_hover_css( $attributes, $device ); } )
128 + );
129 + $css_generator->add_class_styles(
130 + '{{WRAPPER}} .academy-single-course__content-item--feedback .academy-student-course-feedback-ratings .academy-ratings-list-item .academy-ratings-list-item-fill',
131 + $this->get_fill_css( $attributes, '' ),
132 + $this->get_fill_css( $attributes, 'Tablet' ),
133 + $this->get_fill_css( $attributes, 'Mobile' ),
134 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_fill_css( $attributes, $device ); } )
135 + );
136 + $css_generator->add_class_styles(
137 + '{{WRAPPER}} .academy-single-course__content-item--feedback .academy-student-course-feedback-ratings .academy-ratings-list-item .academy-ratings-list-item-fill:hover',
138 + $this->get_fill_hover_css( $attributes, '' ),
139 + $this->get_fill_hover_css( $attributes, 'Tablet' ),
140 + $this->get_fill_hover_css( $attributes, 'Mobile' ),
141 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_fill_hover_css( $attributes, $device ); } )
142 + );
143 + $css_generator->add_class_styles(
144 + '{{WRAPPER}} .academy-single-course__content-item--feedback .academy-student-course-feedback-ratings .academy-ratings-list-item .academy-ratings-list-item-fill-bar',
145 + $this->get_active_fill_css( $attributes, '' ),
146 + $this->get_active_fill_css( $attributes, 'Tablet' ),
147 + $this->get_active_fill_css( $attributes, 'Mobile' ),
148 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_active_fill_css( $attributes, $device ); } )
149 + );
150 + $css_generator->add_class_styles(
151 + '{{WRAPPER}} .academy-single-course__content-item--feedback .academy-student-course-feedback-ratings .academy-ratings-list-item .academy-ratings-list-item-fill-bar:hover',
152 + $this->get_active_fill_hover_css( $attributes, '' ),
153 + $this->get_active_fill_hover_css( $attributes, 'Tablet' ),
154 + $this->get_active_fill_hover_css( $attributes, 'Mobile' ),
155 + $css_generator->custom_device_map( function ( $device ) use ( $attributes ) { return $this->get_active_fill_hover_css( $attributes, $device ); } )
156 + );
157 +
158 + return $css_generator->generate_css();
159 + }
160 +
161 + public function get_feedback_heading_css( $attributes, $device = '' ) {
162 + $typographyValueGlobal = ! empty( $attributes['heading_typographyGlobal'] ) ? $attributes['heading_typographyGlobal'] : '';
163 + $typography_value = ! empty( $attributes['heading_typography'] ) ?
164 + Typography::get_css( $attributes['heading_typography'], '', $device, $typographyValueGlobal )
165 + : array();
166 +
167 + return array_merge(
168 + [ 'color' => Color::get_css( isset( $attributes['heading_color'] ) ? $attributes['heading_color'] : '' ) ],
169 + $typography_value
170 + );
171 + }
172 +
173 + public function get_feedback_heading_hover_css( $attributes, $device = '' ) {
174 + return [ 'color' => Color::get_css( isset( $attributes['heading_hover_color'] ) ? $attributes['heading_hover_color'] : '' ) ];
175 + }
176 +
177 + public function get_feedback_section_css( $attributes, $device = '' ) {
178 + return array_merge(
179 + [ 'background' => Color::get_css( isset( $attributes['section_bg'] ) ? $attributes['section_bg'] : '#FFF' ) ],
180 + Border::get_css( $attributes['border'], '', $device ),
181 + Dimensions::get_css( $attributes['padding'], 'padding', $device ),
182 + BoxShadow::get_css( $attributes['boxShadow'], '', $device ),
183 + Range::get_css([
184 + 'attributeValue' => $attributes['section_height'],
185 + 'attribute_object_key' => 'value',
186 + 'isResponsive' => true,
187 + 'defaultValue' => 100,
188 + 'hasUnit' => true,
189 + 'unitDefaultValue' => '%',
190 + 'property' => 'height',
191 + 'device' => $device,
192 + ]),
193 + Range::get_css([
194 + 'attributeValue' => $attributes['section_width'],
195 + 'attribute_object_key' => 'value',
196 + 'isResponsive' => true,
197 + 'defaultValue' => 100,
198 + 'hasUnit' => true,
199 + 'unitDefaultValue' => '%',
200 + 'property' => 'width',
201 + 'device' => $device,
202 + ]),
203 + );
204 +
205 + }
206 +
207 + public function get_feedback_section_hover_css( $attributes, $device = '' ) {
208 + return array_merge(
209 + [ 'background' => Color::get_css( isset( $attributes['section_bg_hover'] ) ? $attributes['section_bg_hover'] : '#FFF' ) ],
210 + Border::get_hover_css( $attributes['border'], '', $device ),
211 + BoxShadow::get_hover_css( $attributes['boxShadow'], '', $device ),
212 + Range::get_css([
213 + 'attributeValue' => $attributes['transition'],
214 + 'attribute_object_key' => 'value',
215 + 'isResponsive' => false,
216 + 'defaultValue' => 0,
217 + 'hasUnit' => false,
218 + 'unitDefaultValue' => 's',
219 + 'property' => 'transition-duration',
220 + 'device' => $device,
221 + ]),
222 + );
223 + }
224 +
225 + public function get_avg_rating_css( $attributes, $device = '' ) {
226 + $typographyValueGlobal = ! empty( $attributes['avg_typographyGlobal'] ) ? $attributes['avg_typographyGlobal'] : '';
227 + $typography_value = ! empty( $attributes['avg_typography'] ) ?
228 + Typography::get_css( $attributes['avg_typography'], '', $device, $typographyValueGlobal )
229 + : array();
230 +
231 + return array_merge(
232 + [ 'color' => Color::get_css( isset( $attributes['avg_color'] ) ? $attributes['avg_color'] : '#111' ) ],
233 + $typography_value
234 + );
235 + }
236 +
237 + public function get_avg_rating_hover_css( $attributes, $device = '' ) {
238 + return array_merge(
239 + [ 'color' => Color::get_css( isset( $attributes['avg_color_hover'] ) ? $attributes['avg_color_hover'] : '#111' ) ],
240 + Range::get_css([
241 + 'attributeValue' => $attributes['avg_transition'],
242 + 'attribute_object_key' => 'value',
243 + 'isResponsive' => false,
244 + 'defaultValue' => 0,
245 + 'hasUnit' => false,
246 + 'unitDefaultValue' => 's',
247 + 'property' => 'transition-duration',
248 + 'device' => $device,
249 + ]),
250 + );
251 + }
252 +
253 + public function get_rating_star_css( $attributes, $device = '' ) {
254 + return array_merge(
255 + [ 'color' => Color::get_css( isset( $attributes['rating_color'] ) ? $attributes['rating_color'] : '#111' ) ],
256 + Range::get_css([
257 + 'attributeValue' => $attributes['rating_size'],
258 + 'attribute_object_key' => 'value',
259 + 'isResponsive' => true,
260 + 'defaultValue' => 16,
261 + 'hasUnit' => true,
262 + 'unitDefaultValue' => 'px',
263 + 'property' => 'font-size',
264 + 'device' => $device,
265 + ]),
266 + );
267 + }
268 +
269 + public function get_rating_star_hover_css( $attributes, $device = '' ) {
270 + return array_merge(
271 + [ 'color' => Color::get_css( isset( $attributes['rating_color_hover'] ) ? $attributes['rating_color_hover'] : '#111' ) ],
272 + Range::get_css([
273 + 'attributeValue' => $attributes['rating_transition'],
274 + 'attribute_object_key' => 'value',
275 + 'isResponsive' => false,
276 + 'defaultValue' => 0,
277 + 'hasUnit' => false,
278 + 'unitDefaultValue' => 's',
279 + 'property' => 'transition-duration',
280 + 'device' => $device,
281 + ]),
282 + );
283 + }
284 + public function get_total_rating_css( $attributes, $device = '' ) {
285 + $typographyValueGlobal = ! empty( $attributes['total_typographyGlobal'] ) ? $attributes['total_typographyGlobal'] : '';
286 + $typography_value = ! empty( $attributes['total_typography'] ) ?
287 + Typography::get_css( $attributes['total_typography'], '', $device, $typographyValueGlobal )
288 + : array();
289 +
290 + return array_merge(
291 + [ 'color' => Color::get_css( isset( $attributes['total_rating_color'] ) ? $attributes['total_rating_color'] : '#999' ) ],
292 + $typography_value
293 + );
294 + }
295 + public function get_total_rating_hover_css( $attributes, $device = '' ) {
296 + return array_merge(
297 + [ 'color' => Color::get_css( isset( $attributes['total_rating_hover'] ) ? $attributes['total_rating_hover'] : '#999' ) ],
298 + Range::get_css([
299 + 'attributeValue' => $attributes['total_transition'],
300 + 'attribute_object_key' => 'value',
301 + 'isResponsive' => false,
302 + 'defaultValue' => 0,
303 + 'hasUnit' => false,
304 + 'unitDefaultValue' => 's',
305 + 'property' => 'transition-duration',
306 + 'device' => $device,
307 + ]),
308 + );
309 + }
310 +
311 + public function get_feedback_css( $attributes, $device = '' ) {
312 + $typographyValueGlobal = ! empty( $attributes['listTypographyGlobal'] ) ? $attributes['listTypographyGlobal'] : '';
313 + $typography_value = ! empty( $attributes['listTypography'] ) ?
314 + Typography::get_css( $attributes['listTypography'], '', $device, $typographyValueGlobal )
315 + : array();
316 +
317 + return array_merge(
318 + [ 'color' => Color::get_css( isset( $attributes['listColor'] ) ? $attributes['listColor'] : '#999' ) ],
319 + $typography_value
320 + );
321 + }
322 +
323 + public function get_feedback_hover_css( $attributes, $device = '' ) {
324 + return array_merge(
325 + [ 'color' => Color::get_css( isset( $attributes['listColorH'] ) ? $attributes['listColorH'] : '#999' ) ],
326 + Range::get_css([
327 + 'attributeValue' => $attributes['listT'],
328 + 'attribute_object_key' => 'value',
329 + 'isResponsive' => false,
330 + 'defaultValue' => 0,
331 + 'hasUnit' => false,
332 + 'unitDefaultValue' => 's',
333 + 'property' => 'transition-duration',
334 + 'device' => $device,
335 + ]),
336 + );
337 +
338 + }
339 +
340 + public function get_start_css( $attributes, $device = '' ) {
341 + return array_merge(
342 + [ 'color' => Color::get_css( isset( $attributes['starColor'] ) ? $attributes['starColor'] : '#f4c150' ) ],
343 + Range::get_css([
344 + 'attributeValue' => $attributes['startSize'],
345 + 'attribute_object_key' => 'value',
346 + 'isResponsive' => true,
347 + 'defaultValue' => 16,
348 + 'hasUnit' => true,
349 + 'unitDefaultValue' => 'px',
350 + 'property' => 'font-size',
351 + 'device' => $device,
352 + ]),
353 + );
354 + }
355 +
356 + public function get_start_hover_css( $attributes, $device = '' ) {
357 + return array_merge(
358 + [ 'color' => Color::get_css( isset( $attributes['starColorH'] ) ? $attributes['starColorH'] : '#999' ) ],
359 + Range::get_css([
360 + 'attributeValue' => $attributes['startT'],
361 + 'attribute_object_key' => 'value',
362 + 'isResponsive' => false,
363 + 'defaultValue' => 0,
364 + 'hasUnit' => false,
365 + 'unitDefaultValue' => 's',
366 + 'property' => 'transition-duration',
367 + 'device' => $device,
368 + ]),
369 + );
370 + }
371 +
372 + public function get_fill_css( $attributes, $device = '' ) {
373 + return [ 'background' => Color::get_css( isset( $attributes['fillBg'] ) ? $attributes['fillBg'] : '#e7e7e7' ) ];
374 + }
375 +
376 + public function get_fill_hover_css( $attributes, $device = '' ) {
377 + return array_merge(
378 + [ 'background' => Color::get_css( isset( $attributes['fillBgH'] ) ? $attributes['fillBgH'] : '#e7e7e7' ) ],
379 + Range::get_css([
380 + 'attributeValue' => $attributes['fillT'],
381 + 'attribute_object_key' => 'value',
382 + 'isResponsive' => false,
383 + 'defaultValue' => 0,
384 + 'hasUnit' => false,
385 + 'unitDefaultValue' => 's',
386 + 'property' => 'transition-duration',
387 + 'device' => $device,
388 + ]),
389 + );
390 +
391 + }
392 +
393 + public function get_active_fill_css( $attributes, $device = '' ) {
394 + return [ 'background' => Color::get_css( isset( $attributes['fillABg'] ) ? $attributes['fillABg'] : '#e7e7e7' ) ];
395 + }
396 +
397 + public function get_active_fill_hover_css( $attributes, $device = '' ) {
398 + return array_merge(
399 + [ 'background' => Color::get_css( isset( $attributes['fillABgH'] ) ? $attributes['fillABgH'] : '#e7e7e7' ) ],
400 + Range::get_css([
401 + 'attributeValue' => $attributes['fillAT'],
402 + 'attribute_object_key' => 'value',
403 + 'isResponsive' => false,
404 + 'defaultValue' => 0,
405 + 'hasUnit' => false,
406 + 'unitDefaultValue' => 's',
407 + 'property' => 'transition-duration',
408 + 'device' => $device,
409 + ]),
410 + );
411 +
412 + }
413 +
414 + public function render_block_content( $attributes, $content, $block_instance ) {
415 + $course_addition_info_id = method_exists( Helper::class, 'get_attribute_value' ) ? (int) Helper::get_attribute_value( $attributes, 'course_id' ) : (int) ( $attributes['course_id'] ?? 0 );
416 + $course_addition_info_attr = method_exists( Helper::class, 'attr_shortcode' ) ? Helper::attr_shortcode( [ 'course_id' => $course_addition_info_id ] ) : 'course_id="' . esc_attr( $course_addition_info_id ) . '"';
417 + $course_addition_info_shortcode = '[academy_single_course_review_rating ' . trim( $course_addition_info_attr ) . ']';
418 + // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
419 + $course_addition_info_is_edit = defined( 'REST_REQUEST' ) && REST_REQUEST && ( $_REQUEST['context'] ?? '' ) === 'edit';
420 + if ( $course_addition_info_is_edit && $course_addition_info_id && ( $course_addition_info_post = get_post( $course_addition_info_id ) ) ) {
421 + global $post, $wp_query;
422 + $course_addition_info_prev_post = $post;
423 + $course_addition_info_prev_query = $wp_query;
424 + $post = $course_addition_info_post;
425 + setup_postdata( $post );
426 + $wp_query = new \WP_Query( [
427 + 'p' => $course_addition_info_id,
428 + 'post_type' => $course_addition_info_post->post_type,
429 + 'no_found_rows' => 1,
430 + 'posts_per_page' => 1
431 + ] );
432 + $wp_query->is_singular = 1;
433 + $wp_query->is_single = ( $course_addition_info_post->post_type !== 'page' );
434 + $wp_query->is_page = ( $course_addition_info_post->post_type === 'page' );
435 + $wp_query->is_home = $wp_query->is_front_page = 0;
436 + if ( method_exists( $wp_query, 'set' ) ) {
437 + $wp_query->set( 'is_main_query', 1 );
438 + }
439 + $course_addition_info_html = do_shortcode( $course_addition_info_shortcode );
440 + wp_reset_postdata();
441 + $wp_query = $course_addition_info_prev_query;
442 + $post = $course_addition_info_prev_post;
443 + } else {
444 + $course_addition_info_html = do_shortcode( $course_addition_info_shortcode );
445 + }//end if
446 + if ( $course_addition_info_is_edit && trim( wp_strip_all_tags( $course_addition_info_html ) ) === '' ) {
447 + $course_addition_info_html = '<div class="no-data-message"><strong>Editor Only:</strong> No output. Check course ID or data.</div>';
448 + }
449 + return $course_addition_info_html;
450 + }
451 +
452 +}