Tribe__Events__Tickets__Eventbrite__Aggregator::add_license_data( $data, string $endpoint )

This method allows to use the EBT key if EA is not present on the installation, a better mechanism should be used in future to support multiple licenses to EA as right now is only via a meta_key parameter instead using headers can be an option, see the following ticket for future work.


Parameters

(<span class="arrayarray<string,) (Required) mixed> $data An array with the data to build the URL.

$endpoint

(string) (Required) The endpoint used to construct the URL.


Top ↑

Return

(array<string,) mixed> An array with the data used to build the URL.


Top ↑

Source

File: src/Tribe/Aggregator.php

	public function add_license_data( $data, $endpoint ) {
		// The site already has key license use that one instead.
		if ( ! empty( $data['key'] ) ) {
			return $data;
		}

		// And EBT license already exists on the request use that one instead.
		if ( ! empty( $data['licenses'] ) && ! empty( $data['licenses']['tribe-eventbrite'] ) ) {
			return $data;
		}

		$license = tribe( 'eventbrite.pue' )->pue_instance->get_key();

		if ( empty( $license ) ) {
			return $data;
		}

		$data['origin']   = 'eventbrite';
		// Attach the license as part of the request.
		if ( isset( $data['licenses'] ) ) {
			// Make sure 'licenses' is an array.
			if ( ! is_array( $data['licenses'] ) ) {
				$data['licenses'] = (array) $data['licenses'];
			}
			$data['licenses']['tribe-eventbrite'] = $license;
		} else {
			$data['licenses'] = [ 'tribe-eventbrite' => $license ];
		}

		return $data;
	}

Top ↑

Changelog

Changelog
Version Description
4.6.8 Introduced.