You are here

function conditional_fields_available_fields_default_values in Conditional Fields 6.2

Same name and namespace in other branches
  1. 6 conditional_fields.module \conditional_fields_available_fields_default_values()

Load default values from conditional_fields table.

2 calls to conditional_fields_available_fields_default_values()
conditional_fields_content_admin_field in ./conditional_fields.module
Alteration of the field editing form
conditional_fields_fieldgroup_group_edit_form in ./conditional_fields.module
Alteration of the fieldgroup editing form

File

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

Code

function conditional_fields_available_fields_default_values($control_field, $conditional_fields) {
  $default_values = array();
  foreach ($conditional_fields as $field) {
    $query = db_query("SELECT trigger_values FROM {conditional_fields} WHERE control_field_name = '%s' AND field_name = '%s' AND type = '%s'", $field['field_name'], $control_field, $field['type_name']);
    $result = unserialize(db_result($query));
    if ($result) {
      $default_values[$field['field_name']] = $result;
    }
  }
  return $default_values;
}