Tribe__Events__Aggregator__Service::build_url( string $endpoint, array $data = array() )

Builds an endpoint URL


Parameters

$endpoint

(string) (Required) Endpoint for the Event Aggregator service

$data

(array) (Optional) Parameters to add to the URL

Default value: array()


Top ↑

Return

(string|WP_Error)


Top ↑

Source

File: src/Tribe/Aggregator/Service.php

	public function build_url( $endpoint, $data = array() ) {
		$api = $this->api();

		// If we have an WP_Error we return it here
		if ( is_wp_error( $api ) ) {
			return $api;
		}

		// Build the URL
		$url = "{$api->domain}{$api->path}{$api->version}/{$endpoint}";

		// Enforce Key on the Query Data
		$data['key'] = $api->key;

		// If we have data we add it
		$url = add_query_arg( $data, $url );

		return $url;
	}