MAILCHIMP_TOKENS::register_tokens( mixed $tokens = array(), mixed $args = array() )

Register the tokens.


Parameters Parameters

$tokens

(Optional)

Default value: array()

$args

(Optional)

Default value: array()


Top ↑

Return Return

(void)


Source Source

File: src/integrations/mailchimp/tokens/mailchimp-tokens.php

	public function register_tokens( $tokens = array(), $args = array() ) {

		$trigger_integration = $args['integration'];

		$trigger_meta = $args['meta'];

		$tokens_collection = array_merge( $this->get_tokens_collection() );

		$arr_column_tokens_collection = array_column( $tokens_collection, 'name' );

		array_multisort( $arr_column_tokens_collection, SORT_ASC, $tokens_collection );

		$tokens = array();

		foreach ( $tokens_collection as $token ) {
			$tokens[] = array(
				'tokenId'         => str_replace( ' ', '_', $token['id'] ),
				'tokenName'       => $token['name'],
				'tokenType'       => 'text',
				'tokenIdentifier' => strtoupper( 'MAILCHIMP_' . $token['id'] ),
			);
		}

		return $tokens;

	}