Modal::get_modal_content_ajax( string|WP_Error $render_response, array $vars )
Get the Attendee Details modal content, depending on the request.
Contents
Parameters
- $render_response
-
(string|WP_Error) (Required) The render response HTML content or WP_Error with list of errors.
- $vars
-
(array) (Required) The request variables.
Return
(string) $html The response with the HTML of the form, depending on the call.
Source
File: src/Tickets/Admin/Attendees/Modal.php
public function get_modal_content_ajax( $render_response, $vars ) {
if ( 'tec_tickets_attendee_details' !== $vars['request'] ) {
return $render_response;
}
$html = '';
/** @var Tribe__Tickets__Editor__Template $template */
$tickets_template = tribe( 'tickets.editor.template' );
/** @var Tribe__Tickets__Admin__Views $admin_views */
$admin_template = tribe( 'tickets.admin.views' );
$attendee_id = (int) sanitize_text_field( $vars['attendeeId'] );
$provider = tribe_tickets_get_ticket_provider( $attendee_id );
if ( ! $provider ) {
return '<div class="tec-tickets__admin-attendees-modal-attendee-info-value">' . esc_html__( 'Attendee provider not found.', 'event-tickets' ) . '</div>';
}
$attendee = $provider->get_attendee( $attendee_id );
$post_id = (int) sanitize_text_field( $vars['eventId'] );
$ticket_id = (int) sanitize_text_field( $vars['ticketId'] );
$attendee_name = (string) sanitize_text_field( $vars['attendeeName'] );
$attendee_email = (string) sanitize_text_field( $vars['attendeeEmail'] );
// Send the attendee object to the template.
$context = [
'attendee' => $attendee,
'attendee_id' => $attendee_id,
'attendee_name' => $attendee_name,
'attendee_email' => $attendee_email,
'post_id' => $post_id,
'ticket_id' => $ticket_id,
'qr_enabled' => tribe( \TEC\Tickets\QR\Settings::class )->is_enabled( 'attendees-modal' ),
];
$html = $admin_template->template( 'attendees/modal/attendee', $context, false );
$html .= $tickets_template->template( 'v2/components/loader/loader', [], false );
return $html;
}
Changelog
| Version | Description |
|---|---|
| 5.10.0 | Introduced. |