function theme_field_group_table_wrapper

7.x-1.x field_group_table.module theme_field_group_table_wrapper($variables)

Returns HTML for a field_group_table_wrapper.

File

./field_group_table.module, line 209
Adds a "Table" format to Field Groups.

Code

function theme_field_group_table_wrapper($variables) {
  $element = $variables['element'];
  $mode = $element['#mode'];
  $groups = $element['#groups'];
  $settings = $element['#settings'];

  // Build the table rows.
  $rows = array();
  foreach (element_children($element, TRUE) as $child) {
    // In some cases a child may be completely empty and therefore will be
    // useless to us, because it will render as an empty table row. See
    // http://drupal.org/node/1985606 for example.
    if ($mode == 'display' && !in_array($child, $groups) && !isset($element[$child]['#theme']) && !isset($element[$child]['#markup']) && !isset($element[$child]['#prefix']) && !isset($element[$child]['#suffix'])) {
      unset($element[$child]);
      continue;
    }

    $variables = array(
      'element' => $element[$child],
      'settings' => $settings,
      'mode' => $mode,
    );
    unset($element[$child]);

    $rows[] = _field_group_table_row_build($variables);
  }

  $element['#field_group_table']['#rows'] = $rows;

  $output = '<div id="' . $element['#id'] . '"' . drupal_attributes($element['#attributes']) . ">\n";
  $output .= drupal_render($element['#caption']) . "\n";
  $output .= drupal_render($element['#field_group_table']) . "\n";
  $output .= "</div>\n";

  return $output;
}