You are here

function conditional_fields_is_triggered in Conditional Fields 6

Same name and namespace in other branches
  1. 5 conditional_fields.module \conditional_fields_is_triggered()
  2. 6.2 conditional_fields.module \conditional_fields_is_triggered()

Returns true if the field was triggered $selected_values The values of the controlling field selected by the user when creating the node $trigger_values An array containing the information we need to select the trigger values

3 calls to conditional_fields_is_triggered()
conditional_fields_nodeapi in ./conditional_fields.module
Implementation of hook_nodeapi().
conditional_fields_node_editing_form in ./conditional_fields.module
Alteration of the node editing form
conditional_fields_node_editing_form_validate in ./conditional_fields.module
Validation for node editing form.

File

./conditional_fields.module, line 839
Content fields and groups visibility based on the values of user defined 'trigger' fields.

Code

function conditional_fields_is_triggered($selected_values, $trigger_values) {
  foreach ((array) $selected_values as $values) {
    foreach ((array) $values as $value) {
      if (isset($value) && in_array($value, $trigger_values)) {
        return TRUE;
      }
    }
  }
  return FALSE;
}