function field_group_pre_render_htabs in Field Group 7
Same name and namespace in other branches
- 7.2 field_group.module \field_group_pre_render_htabs()
Implements field_group_pre_render_<format-type>. Format type: Horizontal tabs group.
Parameters
$element The field group form element.:
$group The Field group object prepared for pre_render.:
$form The root element or form.:
File
- ./
field_group.module, line 871 - Fieldgroup module.
Code
function field_group_pre_render_htabs(&$element, $group, &$form) {
$classes = 'field-group-' . $group->format_type . '-wrapper';
if (!empty($group->classes)) {
$classes .= ' ' . $group->classes;
}
$id = !empty($element['#id']) ? ' id="' . $element['#id'] . '"' : '';
$element += array(
'#type' => 'horizontal_tabs',
'#title' => check_plain(t($group->label)),
'#theme_wrappers' => array(
'horizontal_tabs',
),
'#prefix' => '<div class="' . $classes . '"' . $id . '>',
'#suffix' => '</div>',
);
// By default vertical_tabs don't have titles but you can override it in the theme.
if (!empty($group->label)) {
$element['#title'] = check_plain($group->label);
}
// Only add form.js on forms.
if (!empty($form['#type']) && $form['#type'] == 'form') {
$element['#attached']['js'][] = 'misc/form.js';
}
$element['#attached']['library'][] = array(
'field_group',
'horizontal-tabs',
);
}