You are here

function conditional_fields_content_fieldapi in Conditional Fields 6.2

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

Implementation of hook_content_fieldapi().

File

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

Code

function conditional_fields_content_fieldapi($ops, $field) {

  // Handle deletion of fields
  if ($ops == 'delete instance') {
    db_query("DELETE FROM {conditional_fields} WHERE type = '%s' AND (control_field_name = '%s' OR field_name = '%s')", $field['type_name'], $field['field_name'], $field['field_name']);
  }
  elseif ($ops == 'create instance') {
    if (!empty($field['conditional_fields']['available_fields'])) {
      conditional_fields_save_field($field['type_name'], $field['field_name'], $field['conditional_fields']['available_fields']);
    }
  }
}