function field_group_add_row in Field Group 7
Same name and namespace in other branches
- 7.2 field_group.field_ui.inc \field_group_add_row()
Helper function to add a row in the overview forms.
1 call to field_group_add_row()
- field_group_field_ui_overview_form_alter in ./
field_group.field_ui.inc - Function to alter the fields overview and display overview screen.
File
- ./
field_group.field_ui.inc, line 358 - 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_add_row($name, $parent_options, $params) {
return array(
'#attributes' => array(
'class' => array(
'draggable',
'field-group',
'add-new',
),
),
'#row_type' => 'add_new_group',
'#js_settings' => array(
'rowHandler' => 'group',
),
'#region_callback' => $params->region_callback,
'label' => array(
'#title_display' => 'invisible',
'#title' => t('Label for new group'),
'#type' => 'textfield',
'#size' => 15,
'#description' => t('Label'),
'#prefix' => '<div class="label-input"><div class="add-new-placeholder">' . t('Add new group') . '</div>',
'#suffix' => '</div>',
),
'weight' => array(
'#type' => 'textfield',
'#default_value' => field_info_max_weight($params->entity_type, $params->bundle, $params->mode) + 3,
'#size' => 3,
'#title_display' => 'invisible',
'#title' => t('Weight for new group'),
'#attributes' => array(
'class' => array(
'field-weight',
),
),
'#prefix' => '<div class="add-new-placeholder"> </div>',
),
'parent_wrapper' => array(
'parent' => array(
'#title_display' => 'invisible',
'#title' => t('Parent for new group'),
'#type' => 'select',
'#options' => $parent_options,
'#empty_value' => '',
'#attributes' => array(
'class' => array(
'field-parent',
),
),
'#prefix' => '<div class="add-new-placeholder"> </div>',
'#parents' => array(
'fields',
$name,
'parent',
),
),
'hidden_name' => array(
'#type' => 'hidden',
'#default_value' => $name,
'#attributes' => array(
'class' => array(
'field-name',
),
),
),
),
'group_name' => array(
'#type' => 'textfield',
'#title_display' => 'invisible',
'#title' => t('Machine name for new group'),
// This field should stay LTR even for RTL languages.
'#field_prefix' => '<span dir="ltr">group_',
'#field_suffix' => '</span>‎',
'#attributes' => array(
'dir' => 'ltr',
),
'#size' => 15,
'#description' => t('Group name (a-z, 0-9, _)'),
'#prefix' => '<div class="add-new-placeholder"> </div>',
'#cell_attributes' => array(
'colspan' => $params->display_overview ? 1 : 2,
),
),
);
}