function field_group_build_entity_groups in Field Group 7.2
Same name and namespace in other branches
- 8.3 field_group.module \field_group_build_entity_groups()
- 8 field_group.module \field_group_build_entity_groups()
- 7 field_group.module \field_group_build_entity_groups()
Preprocess/ Pre-render callback.
Parameters
$vars preprocess vars or form element:
$type The type of object beïng rendered:
Return value
$element Array with re-arranged fields in forms.
See also
field_group_theme_registry_alter
1 call to field_group_build_entity_groups()
- field_group_form_pre_render in ./
field_group.module - Pre render callback for rendering groups.
1 string reference to 'field_group_build_entity_groups'
- field_group_theme_registry_alter in ./
field_group.module - Implements hook_theme_registry_alter().
File
- ./
field_group.module, line 1650 - Fieldgroup module.
Code
function field_group_build_entity_groups(&$vars, $type) {
if ($type == 'form') {
$element =& $vars;
$nest_vars = NULL;
}
else {
$element =& $vars['elements'];
$nest_vars =& $vars;
}
// No groups on the entity.
if (empty($element['#groups'])) {
return $element;
}
// Nest the fields in the corresponding field groups.
field_group_fields_nest($element, $nest_vars);
// Allow others to alter the pre_rendered build.
drupal_alter('field_group_build_pre_render', $element);
// Return the element on forms.
if ($type == 'form') {
return $element;
}
// Put groups inside content if we are rendering an entity_view.
foreach ($element['#groups'] as $group) {
if (!empty($element[$group->group_name])) {
$vars['content'][$group->group_name] = $element[$group->group_name];
}
}
}