Tribe__Tickets__Admin__Ticket_History::add_history_link( array $row_actions, array $item )

Add view/hide history links to each attendee table row where history is available.


Parameters

$row_actions

(array) (Required)

$item

(array) (Required)


Top ↑

Return

(string)


Top ↑

Source

File: src/Tribe/Admin/Ticket_History.php

	public function add_history_link( array $row_actions, array $item ) {
		if ( ! isset( $item[ 'attendee_id' ] ) ) {
			return $row_actions;
		}

		$history = Tribe__Post_History::load( $item[ 'attendee_id' ] );

		if ( ! $history->has_entries() ) {
			return $row_actions;
		}

		$ticket_id = absint( $item[ 'attendee_id' ] );
		$check = wp_create_nonce( 'view-ticket-history-' . $ticket_id );
		$view = esc_html_x( 'View history', 'attendee table', 'event-tickets' );
		$hide = esc_html_x( 'Hide history', 'attendee table', 'event-tickets' );

		$row_actions[] = "
			<span> 
				<a href='#' class='ticket-history' data-ticket-id='$ticket_id' data-check='$check'> $view </a>
				<a href='#' class='hide-ticket-history'> $hide </a>
			</span>
		";

		return $row_actions;
	}