Tribe__Events__Community__Tickets__Shortcodes::enqueue_assets()

Enqueue the scripts and stylesheets for the Community Tickets Shortcodes

Contents


Source

File: src/Tribe/Shortcodes.php

	public function enqueue_assets() {
		wp_enqueue_script( 'event-tickets' );
		wp_enqueue_script( 'events-community-tickets' );
		wp_enqueue_style( 'event-tickets' );
		wp_enqueue_style( 'events-community-tickets-shortcodes' );

		$nonces = array(
			'add_ticket_nonce'    => wp_create_nonce( 'add_ticket_nonce' ),
			'edit_ticket_nonce'   => wp_create_nonce( 'edit_ticket_nonce' ),
			'remove_ticket_nonce' => wp_create_nonce( 'remove_ticket_nonce' ),
			'ajaxurl'             => admin_url( 'admin-ajax.php' ),
		);

		wp_localize_script( 'event-tickets', 'TribeTickets', $nonces );
		wp_localize_script( 'event-tickets', 'tribe_ticket_notices', array(
			'confirm_alert' => esc_html__( 'Are you sure you want to delete this ticket? This cannot be undone.', 'tribe-events-community-events' ),
		) );

		Tribe__Tickets__Metabox::localize_decimal_character();

		// using the event-tickets localization here because it is a pre-requisite, so this translation should be available
		$upload_header_data = array(
			'title'  => esc_html__( 'Ticket header image', 'event-tickets' ),
			'button' => esc_html__( 'Set as ticket header', 'event-tickets' ),
		);
		wp_localize_script( 'event-tickets', 'HeaderImageData', $upload_header_data );

		wp_enqueue_media();
	}

Top ↑

Changelog

Changelog
Version Description
4.7.4 Change to tribe_asset_enqueue().
4.6.2 Introduced.