WPFF_SUBFORM::match_condition( $form_data,  $submitted_data, null $recipes = null )


Parameters Parameters

$form_data

(Required)

$submitted_data

(Required)

$recipes

(null) (Optional)

Default value: null

$trigger_meta

(null) (Required)

$trigger_code

(null) (Required)

$trigger_second_code

(null) (Required)


Top ↑

Return Return

(array|bool)


Source Source

File: src/integrations/wp-fluent-forms/triggers/wpff-subform.php

	public function match_condition( $form_data, $submitted_data, $recipes = null ) {

		if ( null === $recipes ) {
			return false;
		}

		$matches = array();

		foreach ( $recipes as $recipe ) {
			foreach ( $recipe['triggers'] as $trigger ) {
				//  Validate that all needed feilds and value are set
				if (
					isset( $trigger['meta'] ) && ! empty( $trigger['meta'] )
					&& isset( $trigger['meta']['WPFFFORMS'] ) && ! empty( $trigger['meta']['WPFFFORMS'] )
					&& ( (int) $form_data->id === (int) $trigger['meta']['WPFFFORMS'] || '-1' === $trigger['meta']['WPFFFORMS'] )
				) {
					$matches[ $recipe['ID'] ] = [
						'recipe_id' => $recipe['ID'],
					];
				}
			}
		}

		if ( ! empty( $matches ) ) {
			return $matches;
		}

		return false;
	}