function field_group_field_group_pre_render in Field Group 8
Same name and namespace in other branches
- 8.3 field_group.module \field_group_field_group_pre_render()
- 7.2 field_group.module \field_group_field_group_pre_render()
- 7 field_group.module \field_group_field_group_pre_render()
Implements hook_field_group_pre_render().
Parameters
Array $element: Group beïng rendered.
Object $group: The Field group info.
$rendering_object: The entity / form beïng rendered
File
- ./
field_group.module, line 285 - Allows administrators to attach custom fields to fieldable types.
Code
function field_group_field_group_pre_render(&$element, &$group, &$rendering_object) {
// Add all field_group format types to the js settings.
$element['#attached']['drupalSettings']['field_group'] = array(
$group->format_type => [
'mode' => $group->mode,
'context' => $group->context,
'settings' => $group->format_settings,
],
);
$element['#weight'] = $group->weight;
// Call the pre render function for the format type.
$manager = Drupal::service('plugin.manager.field_group.formatters');
$plugin = $manager
->getInstance(array(
'format_type' => $group->format_type,
'configuration' => array(
'label' => $group->label,
'settings' => $group->format_settings,
),
'group' => $group,
));
$plugin
->preRender($element, $rendering_object);
}