You are here

function conditional_fields_rules_condition_is_triggered in Conditional Fields 6.2

Condition: check if the controlled field is triggered

File

includes/conditional_fields.rules.inc, line 27
Rules condition for conditional fields

Code

function conditional_fields_rules_condition_is_triggered($node, $settings) {
  if (!($data = conditional_fields_load_data($node->type))) {
    return FALSE;
  }
  foreach ($data as $field) {
    if ($settings['field_name'] == $field['field_name']) {
      if (!conditional_fields_is_triggered($node->{$field}['control_field_name'], $field['trigger_values'])) {
        return FALSE;
      }
    }
  }
  return TRUE;
}