You are here

function conditional_fields_fieldgroup_group_edit_form in Conditional Fields 6

Same name and namespace in other branches
  1. 6.2 conditional_fields.module \conditional_fields_fieldgroup_group_edit_form()

Alteration of the fieldgroup editing form

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

File

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

Code

function conditional_fields_fieldgroup_group_edit_form(&$form) {
  if (!user_access('administer conditional fields')) {
    return;
  }

  // Find fields with allowed values which are not inside a group
  foreach ($form['#content_type']['fields'] as $field) {
    $in_group = fieldgroup_get_group($form['#content_type']['type'], $field['field_name']);
    if (!$in_group) {
      if ($allowed_values[$field['field_name']] = content_allowed_values($field)) {
        $available_fields[$field['field_name']] = $field;
      }
    }
  }
  if (isset($available_fields)) {
    conditional_fields_content_admin_field_controllable($form, $form['#content_type'], $form['group_name']['#default_value'], $available_fields, $allowed_values, $context);

    // Add validation function
    $form['#validate'][] = 'conditional_fields_content_admin_field_validate';

    // Add submission function
    $form['#submit'] = array_merge(array(
      'conditional_fields_forms_submit',
    ), $form['#submit']);
  }
  return;
}