Tribe__Tickets__Attendees_Table::search_box( $text, $input_id )
{@inheritdoc}
Source
File: src/Tribe/Attendees_Table.php
public function search_box( $text, $input_id ) {
// Workaround to show the search box even when no items are found.
$old_items = $this->items;
$this->items = [
'Temporary',
];
// Get normal search box HTML so we can add our own inputs.
ob_start();
parent::search_box( $text, $input_id );
$search_box = ob_get_clean();
$this->items = $old_items;
$options = [
'purchaser_name' => __( 'Search by Purchaser Name', 'event-tickets' ),
'purchaser_email' => __( 'Search by Purchaser Email', 'event-tickets' ),
'user' => __( 'Search by User ID', 'event-tickets' ),
'order_status' => __( 'Search by Order Status', 'event-tickets' ),
'security_code' => __( 'Search by Security Code', 'event-tickets' ),
'product_id' => __( 'Search by Ticket ID', 'event-tickets' ),
];
/**
* Filters the search types to be shown in the search box for filtering attendees.
*
* @since 4.10.6
*
* @param array $options List of ORM search types and their labels.
*/
$options = apply_filters( 'tribe_tickets_search_attendees_types', $options );
// Default selection.
$selected = 'purchaser_name';
$search_type = sanitize_text_field( tribe_get_request_var( 'tribe_attendee_search_type' ) );
if ( $search_type && array_key_exists( $search_type, $options ) ) {
$selected = $search_type;
}
$args = [
'options' => $options,
'selected' => $selected,
];
// Get our search dropdown.
$custom_search = tribe( 'tickets.admin.views' )->template( 'attendees-table-search', $args, false );
// Add our search dropdown.
$search_box = str_replace( '<input type="search"', $custom_search . '<input type="search"', $search_box );
echo $search_box;
}