You are here

function theme_multifield_table_multiple_value_field in Multifield table 7

Print a single row of multiple fields.

File

theme/theme.inc, line 10
Theme functions for the Mutifield Table module.

Code

function theme_multifield_table_multiple_value_field($variables) {
  $element = $variables['element'];
  $header = array();
  $cells = array();

  // Order field widgets by their widget weight.
  $instances = field_info_instances($element['#entity_type'], $element['#bundle']);
  uasort($instances, '_multifield_table_sort_items_widget_helper');
  foreach ($instances as $field_name => $instance) {
    if (empty($element[$field_name])) {
      continue;
    }
    $header[] = _multifield_table_get_title($element[$field_name]);
    $cells[] = array(
      'data' => $element[$field_name],
    );

    // Remove the original field to prevent duplicate printing.
    unset($element[$field_name]);
  }
  $element['multifield_table'] = array(
    '#theme' => 'table',
    '#header' => $header,
    '#rows' => array(
      $cells,
    ),
    '#weight' => 0,
  );
  $element['#sorted'] = FALSE;
  return drupal_render_children($element);
}