Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825

Warning: foreach() argument must be of type array|object, string given in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 830

Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825

Warning: foreach() argument must be of type array|object, string given in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 830

Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825

Warning: foreach() argument must be of type array|object, string given in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 830

Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825
Trigger_Conditions::find_value_in_trigger_meta( $value,  $match_in,  $recipes )

Pass a value to match and return matched recipe/trigger IDs.


Warning: foreach() argument must be of type array|object, string given in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 830

Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825

Warning: foreach() argument must be of type array|object, string given in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 830

Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825

Warning: foreach() argument must be of type array|object, string given in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 830

Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825

Parameters Parameters

$value

(Required)

$match_in

(Required)

$recipes

(Required)


Top ↑

Return Return

(array)


Source Source

File: src/core/lib/recipe-parts/triggers/trait-trigger-conditions.php

	protected function find_value_in_trigger_meta( $value, $match_in, $recipes ) {
		$matched = array();
		if ( empty( $recipes ) ) {
			return $matched;
		}
		// Add where option is set to Any product.
		foreach ( $recipes as $recipe_id => $recipe ) {
			foreach ( $recipe['triggers'] as $trigger ) {
				// Recipe ID does not exist in $match_in.
				if ( ! isset( $match_in[ $recipe_id ] ) ) {
					continue;
				}
				$trigger_id = absint( $trigger['ID'] );
				// Trigger ID does not exist in $match_in.
				if ( ! isset( $match_in[ $recipe_id ][ $trigger_id ] ) ) {
					continue;
				}
				// $value set is -1 (Any).
				if ( true === $this->get_find_any() && intval( '-1' ) === intval( $match_in[ $recipe_id ][ $trigger_id ] ) ) {
					$matched[ $recipe_id ] = $trigger_id;
				}
				// If value is not an array
				if ( ! is_array( $value ) && (int) $value === (int) $match_in[ $recipe_id ][ $trigger_id ] ) {
					$matched[ $recipe_id ] = $trigger_id;
				}
				// if value is of type array
				if ( is_array( $value ) && in_array( (int) $match_in[ $recipe_id ][ $trigger_id ], array_map( 'absint', $value ), true ) ) {
					$matched[ $recipe_id ] = $trigger_id;
				}
			}
		}
		return $matched;
	}