You are here

function conditional_fields_field_overview_form in Conditional Fields 6.2

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

Find conditional fields and mark them.

1 call to conditional_fields_field_overview_form()
conditional_fields_form_alter in ./conditional_fields.module
Implementation of hook_form_alter().

File

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

Code

function conditional_fields_field_overview_form(&$form) {

  // Check if we have conditional data
  if (!($data = conditional_fields_load_data($form['#type_name']))) {
    return;
  }
  foreach ($data as $field) {
    if (in_array($field['control_field_name'], $form['#fields'])) {
      $form[$field['control_field_name']]['field_name']['#value'] .= theme('conditional_fields_manage_marker', NULL, $field['field_name']);
    }
    if (in_array($field['field_name'], $form['#fields'])) {
      $form[$field['field_name']]['field_name']['#value'] .= theme('conditional_fields_manage_marker', $field['control_field_name'], NULL);
    }

    // Mark groups
    if (in_array($field['field_name'], $form['#groups'])) {
      $form[$field['field_name']]['group_name']['#value'] .= theme('conditional_fields_manage_marker', $field['control_field_name'], NULL);
    }
  }

  // Add validation function
  $form['#validate'] = array_merge(array(
    'conditional_fields_field_overview_form_validate',
  ), $form['#validate']);
}