Em_Tokens::em_possible_tokens( $tokens = array(),  $args = array() )


Parameters Parameters

$tokens

(Optional)

Default value: array()

$args

(Optional)

Default value: array()


Top ↑

Return Return

(array|mixed)


Source Source

File: src/integrations/events-manager/tokens/em-tokens.php

	public function em_possible_tokens( $tokens = array(), $args = array() ) {
		if ( ! automator_do_identify_tokens() ) {
			return $tokens;
		}
		$trigger_meta    = $args['meta'];
		$possible_tokens = array(
			$trigger_meta . '_ATTENDEE_NAME'       => esc_attr__( 'Attendee - Name', 'uncanny-automator' ),
			$trigger_meta . '_ATTENDEE_EMAIL'      => esc_attr__( 'Attendee - Email', 'uncanny-automator' ),
			$trigger_meta . '_ATTENDEE_PHONE'      => esc_attr__( 'Attendee - Phone', 'uncanny-automator' ),
			$trigger_meta . '_BOOKED_SPACES'       => esc_attr__( 'Booking - Spaces booked', 'uncanny-automator' ),
			$trigger_meta . '_COMMENT'             => esc_attr__( 'Booking - Attendee comments', 'uncanny-automator' ),
			$trigger_meta . '_PRICE_PAID'          => esc_attr__( 'Booking - Price paid', 'uncanny-automator' ),
			$trigger_meta . '_START_DATE'          => esc_attr__( 'Event - Start date', 'uncanny-automator' ),
			$trigger_meta . '_END_DATE'            => esc_attr__( 'Event - End date', 'uncanny-automator' ),
			$trigger_meta . '_TOTAL_SPACES'        => esc_attr__( 'Event - Total spaces', 'uncanny-automator' ),
			$trigger_meta . '_MAX_SPACES'          => esc_attr__( 'Event - Maximum spaces per booking', 'uncanny-automator' ),
			$trigger_meta . '_CONFIRMED_SPACES'    => esc_attr__( 'Event - Confirmed spaces', 'uncanny-automator' ),
			$trigger_meta . '_PENDING_SPACES'      => esc_attr__( 'Event - Pending spaces', 'uncanny-automator' ),
			$trigger_meta . '_AVAILABLE_SPACES'    => esc_attr__( 'Event - Available spaces', 'uncanny-automator' ),
			$trigger_meta . '_LOCATION_NAME'       => esc_attr__( 'Location - Name', 'uncanny-automator' ),
			$trigger_meta . '_LOCATION_ADDRESS'    => esc_attr__( 'Location - Address', 'uncanny-automator' ),
			$trigger_meta . '_LOCATION_TOWN'       => esc_attr__( 'Location - Town', 'uncanny-automator' ),
			$trigger_meta . '_LOCATION_STATE'      => esc_attr__( 'Location - State', 'uncanny-automator' ),
			$trigger_meta . '_LOCATION_POSTCODE'   => esc_attr__( 'Location - Postcode', 'uncanny-automator' ),
			$trigger_meta . '_LOCATION_REGION'     => esc_attr__( 'Location - Region', 'uncanny-automator' ),
			$trigger_meta . '_LOCATION_COUNTRY'    => esc_attr__( 'Location - Country', 'uncanny-automator' ),
			$trigger_meta . '_LOCATION_URL'        => esc_attr__( 'Location - URL', 'uncanny-automator' ),
			$trigger_meta . '_LOCATION_LINK_TITLE' => esc_attr__( 'Location - Link text', 'uncanny-automator' ),
		);
		$possible_tokens = apply_filters( 'automator_possible_tokens_' . $trigger_meta, $possible_tokens, $trigger_meta );
		$fields          = array();
		foreach ( $possible_tokens as $token_id => $token_name ) {
			$token_type = 'text';
			if ( $trigger_meta . '_ATTENDEE_EMAIL' === $token_id ) {
				$token_type = 'email';
			}
			$fields[] = array(
				'tokenId'         => $token_id,
				'tokenName'       => $token_name,
				'tokenType'       => $token_type,
				'tokenIdentifier' => $trigger_meta,
			);
		}

		return array_merge( $tokens, $fields );
	}