| 1 field_group.field_ui.inc | field_group_configure_form(array $form, array &$form_state, $group, $view_mode = 'form') |
Configure group on the Manage fields screen.
Parameters
array $form: An associative array containing the structure of the form.
array $form_state: An associative array containing the current state of the form, which is passed by reference.
object $group: Group object.
string $view_mode: The view mode: form or the actual display mode.
File
- core/
modules/ field_group/ field_group.field_ui.inc, line 971 - Field_group.field_ui.inc is a file that contains most functions needed on the Fields UI Manage forms (display and fields).
Code
function field_group_configure_form(array $form, array &$form_state, $group, $view_mode = 'form') {
$form['#group'] = $group;
$form_state['#group'] = $group;
$form['#entity_type'] = $group->entity_type;
$form['#bundle'] = $group->bundle;
$form['#view_mode'] = $view_mode;
$form['#attached']['css'][] = backdrop_get_path('module', 'field_group') . '/css/field_group.field_ui.css';
$field_group_types = field_group_formatter_info();
$format_type_label = $field_group_types['form'][$group->format_type]['label'] '';
$form['format_type'] = array(
'#markup' => t('Field group format: !format_type', array(
'!format_type' => ' <span class="formatter-name">' . $format_type_label . '</span>',
)),
'#weight' => -6,
'#prefix' => '<div class="field-group-formatter">',
'#suffix' => '</div>',
);
$form['label'] = array(
'#type' => 'textfield',
'#title' => t('Field group label'),
'#default_value' => $group->label,
'#weight' => -5,
'#element_validate' => array('field_group_format_settings_label_validate'),
);
$addition = (array) module_invoke_all('field_group_format_settings', $group);
backdrop_alter('field_group_format_settings', $addition, $group);
$form += $addition;
// Give field group implementations the chance to alter the description.
if (!empty($addition['label']['#description'])) {
$form['label']['#description'] = $addition['label']['#description'];
}
$form['actions'] = array(
'#type' => 'actions',
);
$form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => 'Update',
);
$form['actions']['cancel'] = array(
'#type' => 'link',
'#title' => 'Cancel',
'#href' => _field_group_get_admin_path($group->entity_type, $group->bundle, $view_mode),
);
return $form;
}