CF_SUBFORM::match_condition( array $form, array $recipes = null, string $trigger_meta = null, string $trigger_code = null )
Matching Form id because its not an integer.
Contents
Parameters Parameters
- $form
-
(Required) .
- $recipes
-
(Optional) .
Default value: null
- $trigger_meta
-
(Optional) .
Default value: null
- $trigger_code
-
(Optional) .
Default value: null
Return Return
(array|bool)
Source Source
File: src/integrations/caldera-forms/triggers/cf-subform.php
public function match_condition( $form, $recipes = null, $trigger_meta = null, $trigger_code = null ) { if ( null === $recipes ) { return false; } $recipe_ids = array(); $entry_to_match = $form['ID']; foreach ( $recipes as $recipe ) { foreach ( $recipe['triggers'] as $trigger ) { if ( key_exists( $trigger_meta, $trigger['meta'] ) && (string) $trigger['meta'][ $trigger_meta ] === (string) $entry_to_match ) { $recipe_ids[ $recipe['ID'] ] = $recipe['ID']; break; } } } if ( ! empty( $recipe_ids ) ) { return [ 'recipe_ids' => $recipe_ids, 'result' => true ]; } return false; }
Expand full source code Collapse full source code View on Github