MEC_HELPERS::select_event_tickets()

This is a callback method to wp_ajax_ua_mec_select_events hook.


Description Description

The method renders a json array which is immediately followed by die function from wp_send_json.


Top ↑

Return Return

(Uncanny_Automatorvoid.)


Source Source

File: src/integrations/modern-events-calendar/helpers/mec-helpers.php

	public function select_event_tickets() {

		$tickets = array();

		$event_id = filter_input( INPUT_POST, 'value', FILTER_SANITIZE_NUMBER_INT );

		$event_tickets = get_post_meta( $event_id, 'mec_tickets', true );

		if ( ! empty( $event_tickets ) ) {
			foreach ( $event_tickets as $ticket_id => $event_ticket ) {
				$tickets[] = array(
					'value' => $ticket_id,
					'text'  => $event_ticket['name'],
				);
			}
		}

		wp_send_json( $tickets );

	}