PluginProbe ʕ •ᴥ•ʔ
Pods – Custom Content Types and Fields / 2.8.23.4
Pods – Custom Content Types and Fields v2.8.23.4
2.7.31.4 2.8.23.5 2.9.19.5 3.0.10.5 3.1.4.3 3.2.8.4 3.3.9.2 2.8.23.4 2.9.19.4 3.0.10.4 3.1.4.2 3.2.8.3 3.3.9.1 trunk 1.14.8 2.7.31.3 2.8.23.3 2.9.19.3 3.0.10.3 3.1.4.1 3.2.0 3.2.1 3.2.1.1 3.2.2 3.2.4 3.2.5 3.2.6 3.2.7 3.2.7.1 3.2.8 3.2.8.1 3.2.8.2 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 3.3.9
pods / tribe-common / src / Tribe / Dialog / View.php
pods / tribe-common / src / Tribe / Dialog Last commit date
View.php 2 weeks ago
View.php
539 lines
1 <?php
2
3 namespace Tribe\Dialog;
4
5 /**
6 * Class View
7 *
8 * @since 4.10.0
9 */
10 class View extends \Tribe__Template {
11 /**
12 * Where in the themes we will look for templates.
13 *
14 * @since 4.10.0
15 *
16 * @var string
17 */
18 public $template_namespace = 'dialogs';
19
20 /**
21 * View constructor
22 *
23 * @since 4.10.0
24 */
25 public function __construct() {
26 $this->set_template_origin( \Tribe__Main::instance() );
27 $this->set_template_folder( 'src/views/dialog' );
28
29 // Configures this templating class to extract variables.
30 $this->set_template_context_extract( true );
31
32 // Uses the public folders.
33 $this->set_template_folder_lookup( true );
34 }
35
36 /**
37 * Public wrapper for build method.
38 * Contains all the logic/validation checks.
39 *
40 * @since 4.10.0
41 *
42 * @param string $content Content as an HTML string.
43 * @param array $args {
44 * List of arguments to override dialog template.
45 *
46 * @type string $button_id The ID for the trigger button (optional).
47 * @type array $button_classes Any desired classes for the trigger button (optional).
48 * @type array $button_attributes Any desired attributes for the trigger button (optional).
49 * @type boolean $button_disabled Should the button be disabled (optional).
50 * @type string $button_text The text for the dialog trigger button ("Open the dialog window").
51 * @type string $button_type The type for the trigger button (optional).
52 * @type string $button_value The value for the trigger button (optional).
53 * @type boolean $button_display If the dialog button should be displayed or not (optional).
54 * @type string $close_event The dialog close event hook name (`tribe_dialog_close_dialog`).
55 * @type string $content_classes The dialog content classes ("tribe-dialog__content").
56 * @type array $context Any additional context data you need to expose to this file (optional).
57 * @type string $id The unique ID for this dialog (`uniqid()`).
58 * @type string $show_event The dialog event show hook name (`tribe_dialog_show_dialog`).
59 * @type string $template The dialog template name (dialog).
60 * @type string $title The dialog title (optional).
61 * @type string $trigger_classes Classes for the dialog trigger ("tribe_dialog_trigger").
62 *
63 * Dialog script option overrides.
64 *
65 * @type string $append_target The dialog will be inserted after the button, you could supply a selector string here to override (optional).
66 * @type boolean $body_lock Whether to lock the body while dialog open (false).
67 * @type string $close_button_aria_label Aria label for the close button ("Close this dialog window").
68 * @type string $close_button_classes Classes for the close button ("tribe-dialog__close-button").
69 * @type string $content_wrapper_classes Dialog content wrapper classes. This wrapper includes the close button ("tribe-dialog__wrapper").
70 * @type string $effect CSS effect on open. none or fade (optional).
71 * @type string $effect_easing A css easing string to apply ("ease-in-out").
72 * @type int $effect_speed CSS effect speed in milliseconds (optional).
73 * @type string $overlay_classes The dialog overlay classes ("tribe-dialog__overlay").
74 * @type boolean $overlay_click_closes If clicking the overlay closes the dialog (false).
75 * @type string $wrapper_classes The wrapper class for the dialog ("tribe-dialog").
76 * }
77 * @param string $id The unique ID for this dialog. Gets prepended to the data attributes. Generated if not passed (`uniqid()`).
78 * @param boolean $echo Whether to echo the script or to return it (default: true).
79 *
80 * @return string An HTML string of the dialog.
81 */
82 public function render_dialog( $content, $args = [], $id = null, $echo = true ) {
83 // Check for content to be passed.
84 if ( empty( $content ) ) {
85 return '';
86 }
87
88 // Generate an ID if we weren't passed one.
89 if ( is_null( $id ) ) {
90 $id = \uniqid();
91 }
92
93 /** @var \Tribe__Assets $assets */
94 $assets = tribe( 'assets' );
95 $assets->enqueue_group( 'tribe-dialog' );
96
97 $html = $this->build_dialog( $content, $id, $args );
98
99 if ( ! $echo ) {
100 return $html;
101 }
102
103 echo $html;
104 }
105
106 /**
107 * Syntactic sugar for `render_dialog()` to make creating modals easier.
108 * Adds sensible defaults for modals.
109 *
110 * @since 4.10.0
111 *
112 * @param string $content Content as an HTML string.
113 * @param array $args {
114 * List of arguments to override dialog template.
115 *
116 * @type string $button_id The ID for the trigger button (optional).
117 * @type array $button_classes Any desired classes for the trigger button (optional).
118 * @type array $button_attributes Any desired attributes for the trigger button (optional).
119 * @type boolean $button_disabled Should the button be disabled (optional).
120 * @type string $button_text The text for the dialog trigger button ("Open the modal window").
121 * @type string $button_type The type for the trigger button (optional).
122 * @type string $button_value The value for the trigger button (optional).
123 * @type boolean $button_display If the dialog button should be displayed or not (optional).
124 * @type string $close_event The dialog close event hook name (`tribe_dialog_close_modal`).
125 * @type string $content_classes The dialog content classes ("tribe-dialog__content tribe-modal__content").
126 * @type string $title_classes The dialog title classes ("tribe-dialog__title tribe-modal__title").
127 * @type array $context Any additional context data you need to expose to this file (optional).
128 * @type string $id The unique ID for this dialog (`uniqid()`).
129 * @type string $show_event The dialog event hook name (`tribe_dialog_show_modal`).
130 * @type string $template The dialog template name (modal).
131 * @type string $title The dialog title (optional).
132 * @type string $trigger_classes Classes for the dialog trigger ("tribe_dialog_trigger").
133 *
134 * Dialog script option overrides.
135 *
136 * @type string $append_target The dialog will be inserted after the button, you could supply a selector string here to override ("body").
137 * @type boolean $body_lock Whether to lock the body while dialog open (true).
138 * @type string $close_button_aria_label Aria label for the close button ("Close this modal window").
139 * @type string $close_button_classes Classes for the close button ("tribe-dialog__close-button tribe-modal__close-button").
140 * @type string $content_wrapper_classes Dialog content wrapper classes. This wrapper includes the close button ("tribe-dialog__wrapper tribe-modal__wrapper").
141 * @type string $effect CSS effect on open. none or fade ("fade").
142 * @type string $effect_easing A css easing string to apply ("ease-in-out").
143 * @type int $effect_speed CSS effect speed in milliseconds (300).
144 * @type string $overlay_classes The dialog overlay classes ("tribe-dialog__overlay tribe-modal__overlay").
145 * @type boolean $overlay_click_closes If clicking the overlay closes the dialog (true).
146 * @type string $wrapper_classes The wrapper class for the dialog ("tribe-dialog").
147 * }
148 * @param string $id The unique ID for this dialog. Gets prepended to the data attributes. Generated if not passed (`uniqid()`).
149 * @param boolean $echo Whether to echo the script or to return it (default: true).
150 *
151 * @return string An HTML string of the dialog.
152 */
153 public function render_modal( $content, $args = [], $id = null, $echo = true ) {
154 $default_args = [
155 'append_target' => '',
156 'body_lock' => true,
157 'button_text' => __( 'Open the modal window', 'tribe-common' ),
158 'close_button_aria_label' => __( 'Close this modal window', 'tribe-common' ),
159 'close_button_classes' => 'tribe-dialog__close-button tribe-modal__close-button',
160 'close_event' => 'tribe_dialog_close_modal',
161 'content_classes' => 'tribe-dialog__content tribe-modal__content',
162 'content_wrapper_classes' => 'tribe-dialog__wrapper tribe-modal__wrapper',
163 'effect' => 'fade',
164 'effect_speed' => 300,
165 'overlay_classes' => 'tribe-dialog__overlay tribe-modal__overlay',
166 'overlay_click_closes' => true,
167 'show_event' => 'tribe_dialog_show_modal',
168 'template' => 'modal',
169 'title_classes' => [ 'tribe-dialog__title', 'tribe-modal__title' ],
170 ];
171
172 $args = wp_parse_args( $args, $default_args );
173
174 $this->render_dialog( $content, $args, $id, $echo );
175 }
176
177 /**
178 * Syntactic sugar for `render_dialog()` to make creating custom confirmation dialogs easier.
179 * Adds sensible defaults for confirmation dialogs.
180 *
181 * @since 4.10.0
182 *
183 * @param string $content Content as an HTML string.
184 * @param array $args {
185 * List of arguments to override dialog template.
186 *
187 * @type string $button_id The ID for the trigger button (optional).
188 * @type array $button_classes Any desired classes for the trigger button (optional).
189 * @type array $button_attributes Any desired attributes for the trigger button (optional).
190 * @type boolean $button_disabled Should the button be disabled (optional).
191 * @type string $button_text The text for the dialog trigger button ("Open the dialog window").
192 * @type string $button_type The type for the trigger button (optional).
193 * @type string $button_value The value for the trigger button (optional).
194 * @type boolean $button_display If the dialog button should be displayed or not (optional).
195 * @type string $cancel_button_text Text for the "Cancel" button ("Cancel").
196 * @type string $content_classes The dialog content classes ("tribe-dialog__content tribe-confirm__content").
197 * @type string $continue_button_text Text for the "Continue" button ("Confirm").
198 * @type array $context Any additional context data you need to expose to this file (optional).
199 * @type string $id The unique ID for this dialog (`uniqid()`).
200 * @type string $template The dialog template name (confirm).
201 * @type string $title The dialog title (optional).
202 * @type string $trigger_classes Classes for the dialog trigger ("tribe_dialog_trigger").
203 *
204 * Dialog script option overrides.
205 *
206 * @type string $append_target The dialog will be inserted after the button, you could supply a selector string here to override (optional).
207 * @type boolean $body_lock Whether to lock the body while dialog open (true).
208 * @type string $close_button_aria_label Aria label for the close button (optional).
209 * @type string $close_button_classes Classes for the close button ("tribe-dialog__close-button--hidden").
210 * @type string $close_event The dialog close event hook name (`tribe_dialog_close_confirm`).
211 * @type string $content_wrapper_classes Dialog content wrapper classes. This wrapper includes the close button ("tribe-dialog__wrapper tribe-confirm__wrapper").
212 * @type string $effect CSS effect on open. none or fade (optional).
213 * @type string $effect_easing A css easing string to apply ("ease-in-out").
214 * @type int $effect_speed CSS effect speed in milliseconds (optional).
215 * @type string $overlay_classes The dialog overlay classes ("tribe-dialog__overlay tribe-confirm__overlay").
216 * @type boolean $overlay_click_closes If clicking the overlay closes the dialog (false).
217 * @type string $show_event The dialog event hook name (`tribe_dialog_show_confirm`).
218 * @type string $wrapper_classes The wrapper class for the dialog ("tribe-dialog").
219 * }
220 * @param string $id The unique ID for this dialog. Gets prepended to the data attributes. Generated if not passed (`uniqid()`).
221 * @param boolean $echo Whether to echo the script or to return it (default: true).
222 *
223 * @return string An HTML string of the dialog.
224 */
225 public function render_confirm( $content, $args = [], $id = null, $echo = true ) {
226 $default_args = [
227 'body_lock' => true,
228 'cancel_button_text' => __( 'Cancel', 'tribe-common' ),
229 'continue_button_text' => __( 'Confirm', 'tribe-common' ),
230 'close_button_aria_label' => '',
231 'close_button_classes' => 'tribe-dialog__close-button--hidden',
232 'close_event' => 'tribe_dialog_close_confirm',
233 'content_classes' => 'tribe-dialog__content tribe-confirm__content',
234 'content_wrapper_classes' => 'tribe-dialog__wrapper tribe-confirm__wrapper',
235 'overlay_classes' => 'tribe-dialog__overlay tribe-confirm__overlay',
236 'show_event' => 'tribe_dialog_show_confirm',
237 'template' => 'confirm',
238 'title_classes' => [ 'tribe-dialog__title', 'tribe-confirm__title' ],
239 ];
240
241 $args = wp_parse_args( $args, $default_args );
242
243 $this->render_dialog( $content, $args, $id, $echo );
244 }
245
246 /**
247 * Syntactic sugar for `render_dialog()` to make creating custom alerts easier.
248 * Adds sensible defaults for alerts.
249 *
250 * @since 4.10.0
251 *
252 * @param string $content Content as an HTML string.
253 * @param array $args {
254 * List of arguments to override dialog template.
255 *
256 * @type string $alert_button_text Text for the "OK" button ("OK").
257 * @type string $button_id The ID for the trigger button (optional).
258 * @type array $button_classes Any desired classes for the trigger button (optional).
259 * @type array $button_attributes Any desired attributes for the trigger button (optional).
260 * @type boolean $button_disabled Should the button be disabled (optional).
261 * @type string $button_text The text for the dialog trigger button ("Open the dialog window").
262 * @type string $button_type The type for the trigger button (optional).
263 * @type string $button_value The value for the trigger button (optional).
264 * @type boolean $button_display If the dialog button should be displayed or not (optional).
265 * @type string $content_classes The dialog content classes ("tribe-dialog__content tribe-alert__content").
266 * @type string $title_classes The dialog title classes ("tribe-dialog__title tribe-alert__title").
267 * @type array $context Any additional context data you need to expose to this file (optional).
268 * @type string $id The unique ID for this dialog (`uniqid()`).
269 * @type string $template The dialog template name (alert).
270 * @type string $title The dialog title (optional).
271 * @type string $trigger_classes Classes for the dialog trigger ("tribe_dialog_trigger").
272 *
273 * Dialog script option overrides.
274 *
275 * @type string $append_target The dialog will be inserted after the button, you could supply a selector string here to override (optional).
276 * @type boolean $body_lock Whether to lock the body while dialog open (true).
277 * @type string $close_button_aria_label Aria label for the close button (optional).
278 * @type string $close_button_classes Classes for the close button ("tribe-dialog__close-button--hidden").
279 * @type string $close_event The dialog close event hook name (`tribe_dialog_close_alert`).
280 * @type string $content_wrapper_classes Dialog content wrapper classes. This wrapper includes the close button ("tribe-dialog__wrapper tribe-alert__wrapper").
281 * @type string $effect CSS effect on open. none or fade (optional).
282 * @type string $effect_easing A css easing string to apply ("ease-in-out").
283 * @type int $effect_speed CSS effect speed in milliseconds (optional).
284 * @type string $overlay_classes The dialog overlay classes ("tribe-dialog__overlay tribe-alert__overlay").
285 * @type boolean $overlay_click_closes If clicking the overlay closes the dialog (false).
286 * @type string $show_event The dialog event hook name (`tribe_dialog_show_alert`).
287 * @type string $wrapper_classes The wrapper class for the dialog ("tribe-dialog").
288 * }
289 * @param string $id The unique ID for this dialog. Gets prepended to the data attributes. Generated if not passed (`uniqid()`).
290 * @param boolean $echo Whether to echo the script or to return it (default: true).
291 *
292 * @return string An HTML string of the dialog.
293 */
294 public function render_alert( $content, $args = [], $id = null, $echo = true ) {
295 $default_args = [
296 'alert_button_text' => __( 'OK', 'tribe-common' ),
297 'body_lock' => true,
298 'close_button_aria_label' => '',
299 'close_button_classes' => 'tribe-dialog__close-button--hidden',
300 'close_event' => 'tribe_dialog_close_alert',
301 'content_classes' => 'tribe-dialog__content tribe-alert__content',
302 'content_wrapper_classes' => 'tribe-dialog__wrapper tribe-alert__wrapper',
303 'overlay_classes' => 'tribe-dialog__overlay tribe-alert__overlay',
304 'show_event' => 'tribe_dialog_show_alert',
305 'template' => 'alert',
306 'title_classes' => [ 'tribe-dialog__title', 'tribe-alert__title' ],
307 ];
308
309 $args = wp_parse_args( $args, $default_args );
310
311 $this->render_dialog( $content, $args, $id, $echo );
312 }
313
314 /**
315 * Factory method for dialog HTML
316 *
317 * @since 4.10.0
318 *
319 * @param string $content HTML dialog content.
320 * @param string $id The unique ID for this dialog (`uniqid()`) Gets prepended to the data attributes.
321 * @param array $args {
322 * List of arguments to override dialog template.
323 *
324 * @type string $button_id The ID for the trigger button (optional).
325 * @type array $button_classes Any desired classes for the trigger button (optional).
326 * @type array $button_attributes Any desired attributes for the trigger button (optional).
327 * @type boolean $button_disabled Should the button be disabled (optional).
328 * @type string $button_text The text for the dialog trigger button ("Open the dialog window").
329 * @type string $button_type The type for the trigger button (optional).
330 * @type string $button_value The value for the trigger button (optional).
331 * @type boolean $button_display If the dialog button should be displayed or not (optional).
332 * @type string $close_event The dialog event hook name (`tribe_dialog_close_dialog`).
333 * @type string $content_classes The dialog content classes ("tribe-dialog__content").
334 * @type string $title_classes The dialog title classes ("tribe-dialog__title").
335 * @type array $context Any additional context data you need to expose to this file (optional).
336 * @type string $id The unique ID for this dialog (`uniqid()`).
337 * @type string $show_event The dialog event hook name (`tribe_dialog_show_dialog`).
338 * @type string $template The dialog template name (dialog).
339 * @type string $title The dialog title (optional).
340 * @type string $trigger_classes Classes for the dialog trigger ("tribe_dialog_trigger").
341 *
342 * Dialog script option overrides.
343 *
344 * @type string $append_target The dialog will be inserted after the button, you could supply a selector string here to override (optional).
345 * @type boolean $body_lock Whether to lock the body while dialog open (false).
346 * @type string $close_button_aria_label Aria label for the close button ("Close this dialog window").
347 * @type string $close_button_classes Classes for the close button ("tribe-dialog__close-button").
348 * @type string $content_wrapper_classes Dialog content wrapper classes. This wrapper includes the close button ("tribe-dialog__wrapper").
349 * @type string $effect CSS effect on open. none or fade (optional).
350 * @type string $effect_easing A css easing string to apply ("ease-in-out").
351 * @type int $effect_speed CSS effect speed in milliseconds (optional).
352 * @type string $overlay_classes The dialog overlay classes ("tribe-dialog__overlay").
353 * @type boolean $overlay_click_closes If clicking the overlay closes the dialog (false).
354 * @type string $wrapper_classes The wrapper class for the dialog ("tribe-dialog").
355 * }
356 *
357 * @return string An HTML string of the dialog.
358 */
359 private function build_dialog( $content, $id, $args ) {
360 $default_args = [
361 'button_classes' => '',
362 'button_attributes' => [],
363 'button_disabled' => false,
364 'button_id' => '',
365 'button_name' => '',
366 'button_text' => __( 'Open the dialog window', 'tribe-common' ),
367 'button_type' => '',
368 'button_value' => '',
369 'button_display' => true,
370 'close_event' => 'tribe_dialog_close_dialog',
371 'content_classes' => 'tribe-dialog__content',
372 'context' => '',
373 'show_event' => 'tribe_dialog_show_dialog',
374 'template' => 'dialog',
375 'title_classes' => 'tribe-dialog__title',
376 'title' => '',
377 'trigger_classes' => 'tribe_dialog_trigger',
378 // Dialog script options.
379 'append_target' => '', // The dialog will be inserted after the button, you could supply a selector string here to override.
380 'body_lock' => false, // Lock the body while dialog open?
381 'close_button_aria_label' => __( 'Close this dialog window', 'tribe-common' ), // Aria label for close button.
382 'close_button_classes' => 'tribe-dialog__close-button', // Classes for close button.
383 'content_wrapper_classes' => 'tribe-dialog__wrapper', // Dialog content classes.
384 'effect' => 'none', // None or fade (for now).
385 'effect_speed' => 0, // Effect speed in milliseconds.
386 'effect_easing' => 'ease-in-out', // A css easing string.
387 'overlay_classes' => 'tribe-dialog__overlay', // Overlay classes.
388 'overlay_click_closes' => false, // Clicking overlay closes dialog.
389 'wrapper_classes' => 'tribe-dialog', // The wrapper class for the dialog.
390 ];
391
392 $args = wp_parse_args( $args, $default_args );
393
394 $args[ 'content' ] = $content;
395 $args[ 'id' ] = $id;
396
397 /**
398 * Allow us to filter the dialog arguments.
399 *
400 * @since 4.10.0
401 *
402 * @param array $args The dialog arguments.
403 * @param string $content HTML content string.
404 */
405 $args = apply_filters( 'tribe_dialog_args', $args, $content );
406
407 $template = $args[ 'template' ];
408 /**
409 * Allow us to filter the dialog template name.
410 *
411 * @since 4.10.0
412 *
413 * @param string $template The dialog template name.
414 * @param array $args The dialog arguments.
415 */
416 $template_name = apply_filters( 'tribe_dialog_template', $template, $args );
417
418 ob_start();
419
420 $this->template( $template_name, $args, true );
421
422 $this->get_dialog_script( $args );
423
424 $html = ob_get_clean();
425
426 /**
427 * Allow us to filter the dialog output (HTML string).
428 *
429 * @since 4.10.0
430 *
431 * @param string $html The dialog HTML string.
432 * @param array $args The dialog arguments.
433 */
434 return apply_filters( 'tribe_dialog_html', $html, $args );
435 }
436
437 /**
438 * Get dialog <script> to be rendered.
439 *
440 * @since 4.10.0
441 *
442 * @param array $args List of arguments for the dialog script. See \Tribe\Dialog\View->build_dialog().
443 * @param boolean $echo Whether to echo the script or to return it (default: true).
444 *
445 * @return string|void The dialog <script> HTML or nothing if $echo is true.
446 */
447 public function get_dialog_script( $args, $echo = true ) {
448 $args = [
449 'appendTarget' => $args[ 'append_target' ],
450 'bodyLock' => $args[ 'body_lock' ],
451 'closeButtonAriaLabel' => $args[ 'close_button_aria_label' ],
452 'closeButtonClasses' => $args[ 'close_button_classes' ],
453 'closeEvent' => $args[ 'close_event' ],
454 'contentClasses' => $args[ 'content_wrapper_classes' ],
455 'effect' => $args[ 'effect' ],
456 'effectEasing' => $args[ 'effect_easing' ],
457 'effectSpeed' => $args[ 'effect_speed' ],
458 'id' => $args[ 'id' ],
459 'overlayClasses' => $args[ 'overlay_classes' ],
460 'overlayClickCloses' => $args[ 'overlay_click_closes' ],
461 'showEvent' => $args[ 'show_event' ],
462 'closeEvent' => $args[ 'close_event' ],
463 'template' => $args[ 'template' ],
464 'wrapperClasses' => esc_attr( $args[ 'wrapper_classes' ] ),
465 ];
466
467 /**
468 * Allows for modifying the arguments before they are passed to the dialog script.
469 *
470 * @since 4.10.0
471 *
472 * @param array $args List of arguments to override dialog script. See \Tribe\Dialog\View->build_dialog().
473 */
474 $args = apply_filters( 'tribe_dialog_script_args', $args );
475
476 // Escape all argument values.
477 $args = array_map( 'esc_html', $args );
478
479 $args[ 'trigger' ] = "[data-js='" . esc_attr( 'trigger-dialog-' . $args[ 'id' ] ) . "' ]";
480
481 ob_start();
482 ?>
483 <script>
484 var tribe = tribe || {};
485 tribe.dialogs = tribe.dialogs || [];
486 tribe.dialogs.dialogs = tribe.dialogs.dialogs || [];
487
488 tribe.dialogs.dialogs.push( <?php echo json_encode( $args ); ?> );
489
490 <?php
491 /**
492 * Allows for injecting additional scripts (button actions, etc).
493 *
494 * @since 4.10.0
495 *
496 * @param array $args List of arguments to override dialog script. See \Tribe\Dialog\View->build_dialog().
497 */
498 do_action( 'tribe_dialog_additional_scripts', $args );
499
500 /**
501 * Allows for injecting additional scripts (button actions, etc) by template.
502 *
503 * @since 4.10.0
504 *
505 * @param array $args List of arguments to override dialog script. See \Tribe\Dialog\View->build_dialog().
506 */
507 do_action( 'tribe_dialog_additional_scripts_' . $args[ 'template' ], $args );
508
509 /**
510 * Allows for injecting additional scripts (button actions, etc) by dialog ID.
511 *
512 * @since 4.10.0
513 *
514 * @param array $args List of arguments to override dialog script. See \Tribe\Dialog\View->build_dialog().
515 */
516 do_action( 'tribe_dialog_additional_scripts_' . $args[ 'id' ], $args );
517 ?>
518 </script>
519 <?php
520 $html = ob_get_clean();
521
522 /**
523 * Allows for modifying the HTML before it is echoed or returned.
524 *
525 * @since 4.10.0
526 *
527 * @param array $args List of arguments to override dialog script. See \Tribe\Dialog\View->build_dialog().
528 */
529 $html = apply_filters( 'tribe_dialog_script_html', $html );
530
531 if ( $echo ) {
532 echo $html;
533 return;
534 }
535
536 return $html;
537 }
538 }
539