You are here

function field_group_pre_render in Field Group 8

Same name and namespace in other branches
  1. 8.3 field_group.module \field_group_pre_render()
  2. 7.2 field_group.module \field_group_pre_render()
  3. 7 field_group.module \field_group_pre_render()

Function to pre render the field group element.

Parameters

$element: Render array of group element that needs to be created.

$group: Object with the group information.

$rendering_object: The entity / form beïng rendered.

See also

field_group_fields_nest()

1 call to field_group_pre_render()
field_group_fields_nest in ./field_group.module
Recursive function to nest fields in the field groups.

File

./field_group.module, line 526
Allows administrators to attach custom fields to fieldable types.

Code

function field_group_pre_render(&$element, $group, &$rendering_object) {

  // Only run the pre_render function if the group has elements.
  // $group->group_name
  if ($element == array()) {
    return;
  }

  // Let modules define their wrapping element.
  // Note that the group element has no properties, only elements.
  foreach (Drupal::moduleHandler()
    ->getImplementations('field_group_pre_render') as $module) {

    // The intention here is to have the opportunity to alter the
    // elements, as defined in hook_field_group_formatter_info.
    // Note, implement $element by reference!
    $function = $module . '_field_group_pre_render';
    $function($element, $group, $rendering_object);
  }

  // Allow others to alter the pre_render.
  Drupal::moduleHandler()
    ->alter('field_group_pre_render', $element, $group, $rendering_object);
}