Tokens::get_parser_object_from_trigger( string $trigger_code, string $token_id = '' )


Parameters Parameters

$trigger_code

(string) (Required)

$token_id

(string) (Optional)

Default value: ''


Top ↑

Return Return

(mixed|null)


Source Source

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

	public static function get_parser_object_from_trigger( string $trigger_code, string $token_id = '' ) {
		if ( empty( $trigger_code ) || empty( $token_id ) ) {
			return null;
		}
		$tokens = Automator()->get->value_from_trigger_meta( $trigger_code, 'tokens' );
		if ( empty( $tokens ) ) {
			return null;
		}
		foreach ( $tokens as $token ) {
			if ( strtoupper( $token_id ) === strtoupper( $token['tokenId'] ) ) {
				return isset( $token['parserObject'] ) ? $token['parserObject'] : null;
			}
		}

		return null;
	}