| 1 |
<?php |
| 2 |
/** |
| 3 |
* Accessible confirmation dialog for shell and step-specific decisions. |
| 4 |
* |
| 5 |
* @package Booking Calendar |
| 6 |
* @var array<string,mixed> $template_context Authorized dialog context. |
| 7 |
*/ |
| 8 |
|
| 9 |
if ( ! defined( 'ABSPATH' ) ) { |
| 10 |
exit; |
| 11 |
} |
| 12 |
|
| 13 |
$dialog_id = isset( $template_context['dialog_id'] ) ? (string) $template_context['dialog_id'] : ''; |
| 14 |
$dialog_action = isset( $template_context['action'] ) ? (string) $template_context['action'] : ''; |
| 15 |
$dialog_title = isset( $template_context['title'] ) ? (string) $template_context['title'] : ''; |
| 16 |
$dialog_description = isset( $template_context['description'] ) ? (string) $template_context['description'] : ''; |
| 17 |
$dialog_details = isset( $template_context['details'] ) && is_array( $template_context['details'] ) ? $template_context['details'] : array(); |
| 18 |
$dialog_note = isset( $template_context['note'] ) ? (string) $template_context['note'] : ''; |
| 19 |
$cancel_label = isset( $template_context['cancel_label'] ) ? (string) $template_context['cancel_label'] : __( 'Cancel', 'booking' ); |
| 20 |
$confirm_label = isset( $template_context['confirm_label'] ) ? (string) $template_context['confirm_label'] : __( 'Continue', 'booking' ); |
| 21 |
$dialog_classes = 'wpbc_setup_wizard__dialog'; |
| 22 |
|
| 23 |
$dialog_details = array_values( |
| 24 |
array_filter( |
| 25 |
array_map( |
| 26 |
static function ( $dialog_detail ) { |
| 27 |
return is_scalar( $dialog_detail ) ? trim( (string) $dialog_detail ) : ''; |
| 28 |
}, |
| 29 |
$dialog_details |
| 30 |
) |
| 31 |
) |
| 32 |
); |
| 33 |
|
| 34 |
if ( ! empty( $dialog_details ) ) { |
| 35 |
$dialog_classes .= ' wpbc_setup_wizard__dialog--with-details'; |
| 36 |
} |
| 37 |
?> |
| 38 |
<div class="wpbc_setup_wizard__dialog-backdrop" data-wpbc-setup-wizard-dialog="<?php echo esc_attr( $dialog_action ); ?>" hidden> |
| 39 |
<div class="<?php echo esc_attr( $dialog_classes ); ?>" id="<?php echo esc_attr( $dialog_id ); ?>" role="dialog" aria-modal="true" aria-labelledby="<?php echo esc_attr( $dialog_id ); ?>-title" aria-describedby="<?php echo esc_attr( $dialog_id ); ?>-description" tabindex="-1"> |
| 40 |
<h2 id="<?php echo esc_attr( $dialog_id ); ?>-title"><?php echo esc_html( $dialog_title ); ?></h2> |
| 41 |
<div class="wpbc_setup_wizard__dialog-content" id="<?php echo esc_attr( $dialog_id ); ?>-description"> |
| 42 |
<p><?php echo esc_html( $dialog_description ); ?></p> |
| 43 |
<?php if ( ! empty( $dialog_details ) ) : ?> |
| 44 |
<ul class="wpbc_setup_wizard__dialog-details"> |
| 45 |
<?php foreach ( $dialog_details as $dialog_detail ) : ?> |
| 46 |
<li><?php echo esc_html( $dialog_detail ); ?></li> |
| 47 |
<?php endforeach; ?> |
| 48 |
</ul> |
| 49 |
<?php endif; ?> |
| 50 |
<?php if ( '' !== $dialog_note ) : ?> |
| 51 |
<p class="wpbc_setup_wizard__dialog-note"><?php echo esc_html( $dialog_note ); ?></p> |
| 52 |
<?php endif; ?> |
| 53 |
</div> |
| 54 |
<div class="wpbc_setup_wizard__dialog-actions"> |
| 55 |
<button type="button" class="button" data-wpbc-setup-wizard-dialog-cancel><?php echo esc_html( $cancel_label ); ?></button> |
| 56 |
<button type="button" class="button button-primary" data-wpbc-setup-wizard-confirm="<?php echo esc_attr( $dialog_action ); ?>"><?php echo esc_html( $confirm_label ); ?></button> |
| 57 |
</div> |
| 58 |
</div> |
| 59 |
</div> |
| 60 |
|