function conditional_fields_fieldgroup_edit_group_form in Conditional Fields 5
Alteration of the fieldgroup editing form
1 call to conditional_fields_fieldgroup_edit_group_form()
- conditional_fields_form_alter in ./
conditional_fields.module - Implementation of hook_form_alter()
File
- ./
conditional_fields.module, line 313
Code
function conditional_fields_fieldgroup_edit_group_form(&$form) {
if (!user_access('administer conditional fields')) {
return;
}
// We can't edit conditional fields on group creation because we have no access to group name
if ($form['#parameters'][3] == 'add') {
return;
}
$type = $form['#parameters'][1];
// Find fields with allowed values which are not inside a group
foreach ($type['fields'] as $field) {
$in_group = fieldgroup_get_group($type['type'], $field['field_name']);
if (!$in_group) {
if ($allowed_values[$field['field_name']] = conditional_fields_allowed_values($field)) {
$available_fields[$field['field_name']] = $field;
}
}
}
if (isset($available_fields)) {
$form = _conditional_fields_build_form($type, $form, $form['group_name']['#default_value'], array(), $available_fields, $allowed_values, 'group', '');
// Add extra submission funcion
$form['#submit'] = $form['#submit'] + array(
'conditional_fields_forms_submit' => array(
$type['type'],
$form['group_name']['#default_value'],
),
);
}
return;
}