Tokens::build( $args )

Build token sentence, {{trigger_code:token}}


Parameters Parameters

$trigger_code

(Required)

$token_id

(Required)

$type

(Required)

$prefix

(Required)


Top ↑

Return Return

(array)


Source Source

File: src/core/lib/recipe-parts/trait-tokens.php

	public static function build( array $args ) {
		$trigger_code = isset( $args['trigger_code'] ) ? esc_attr( $args['trigger_code'] ) : null;
		if ( null === $trigger_code || empty( $trigger_code ) ) {
			return array();
		}
		$token_id = isset( $args['token_id'] ) ? esc_attr( $args['token_id'] ) : null;
		$type     = isset( $args['type'] ) ? esc_attr( $args['type'] ) : null;
		$prefix   = isset( $args['prefix'] ) ? esc_attr( $args['prefix'] ) : '';
//		$parsing_func = self::get_token_parser();
//		$parse_from = isset( $args['parse_from'] ) ? $args['parse_from'] : null;

		return array(
			'tokenId'         => strtoupper( $token_id ),
			'tokenName'       => self::generate_token_name( $token_id, $prefix ),
			'tokenType'       => $type,
			'tokenIdentifier' => $trigger_code,
//			'tokenParser'     => $parsing_func,
//			'parserObject'    => $parse_from,
		);
	}