You are here

function theme_field_collection_table_multiple_value_field in Field Collection Table 7

Print a single row of multiple fields.

File

theme/theme.inc, line 6

Code

function theme_field_collection_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, '_field_collection_table_sort_items_widget_helper');
  foreach (array_keys($instances) as $field_name) {
    if (empty($element[$field_name])) {
      continue;
    }
    if (!isset($element[$field_name]['#access']) || $element[$field_name]['#access']) {
      $header[] = _field_collection_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['field_collection_table'] = array(
    '#theme' => 'table',
    '#header' => $header,
    '#rows' => array(
      $cells,
    ),
    '#weight' => 0,
  );
  $element['#sorted'] = FALSE;
  return drupal_render_children($element);
}