You are here

function field_group_field_group_pre_render in Field Group 7

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

Implements hook_field_group_pre_render().

Parameters

Array $elements by address.:

Object $group The Field group info.:

File

./field_group.module, line 658
Fieldgroup module.

Code

function field_group_field_group_pre_render(&$element, &$group, &$form) {
  field_group_pre_render_prepare($group);
  $view_mode = isset($form['#view_mode']) ? $form['#view_mode'] : 'form';

  // Add all field_group format types to the js settings.
  $form['#attached']['js'][] = array(
    'data' => array(
      'field_group' => array(
        $group->format_type => $view_mode,
      ),
    ),
    'type' => 'setting',
  );
  if (isset($group->format_settings['instance_settings']['id']) && !empty($group->format_settings['instance_settings']['id'])) {
    $element['#id'] = drupal_html_id($group->format_settings['instance_settings']['id']);
  }
  $element['#weight'] = $group->weight;

  // Call the pre render function for the format type.
  $function = "field_group_pre_render_" . str_replace("-", "_", $group->format_type);
  if (function_exists($function)) {
    $function($element, $group, $form);
  }
}