Automator_Input_Parser::parse_inner_token_post_id_part( $pieces,  $args )

This function parses “post ID” part of inner token {{POSTMETA:[[TOKEN]]:[[meta_key]]}} and replace its value in actual token


Parameters Parameters

$pieces

(Required)

$args

(Required)


Top ↑

Return Return

(mixed)


Source Source

File: src/core/lib/utilities/class-automator-input-parser.php

	public function parse_inner_token_post_id_part( $pieces, $args ) {
		if ( ! array_key_exists( 1, $pieces ) ) {
			return $pieces;
		}
		if ( ! preg_match( '/\[\[(.+)\]\]/', $pieces[1], $arr ) ) {
			return $pieces;
		}
		$recipe_id    = $args['recipe_id'];
		$user_id      = $args['user_id'];
		$trigger_args = $args;
		unset( $trigger_args['pieces'] );
		$token     = str_replace(
			array( '[', ']', ';' ),
			array(
				'{',
				'}',
				':',
			),
			$arr[0]
		);
		$parsed    = $this->text( $token, $recipe_id, $user_id, $trigger_args );
		$pieces[1] = apply_filters( 'automator_parse_inner_token', $parsed, $token, $pieces, $args );

		return $pieces;
	}