You are here

function tapir_gather_rows in Ubercart 6.2

Same name and namespace in other branches
  1. 7.3 uc_store/includes/tapir.inc \tapir_gather_rows()

Pre-render callback for tapir_table elements.

Gathers children of the tapir_table element into the #rows array. This allows the element to render the children within the table as rows. Non-row children are rendered after the table.

1 string reference to 'tapir_gather_rows'
uc_store_elements in uc_store/uc_store.module
Implements hook_elements().

File

uc_store/includes/tapir.inc, line 46
Contains the TAPIr code rolled into Ubercart core from Drupal contrib.

Code

function tapir_gather_rows($element) {
  foreach (element_children($element) as $row) {
    foreach (array_keys($element['#columns']) as $col_id) {
      if (isset($element[$row][$col_id])) {
        $element['#rows'][$row][$col_id] = $element[$row][$col_id];
        unset($element[$row][$col_id]);
      }
    }
    $element['#rows'][$row]['#attributes'] = isset($element[$row]['#attributes']) ? $element[$row]['#attributes'] : array();
  }
  return $element;
}