2c2 < index 47c99d9..35d02ce 100644 --- > index 3683d37..dccdcc0 100644 5c5 < @@ -2009,9 +2009,11 @@ function drupal_pre_render_table(array $element) { --- > @@ -2061,9 +2061,11 @@ function drupal_pre_render_table(array $element) { 19c19 < @@ -2091,52 +2093,63 @@ function drupal_pre_render_table(array $element) { --- > @@ -2143,52 +2145,38 @@ function drupal_pre_render_table(array $element) { 65,66c65 < < - // Check if we're dealing with a simple or complex column --- > + 69c68 < + $variables['header'] = array_values($variables['header']); --- > + $variables['header'] = array_values($variables['header']); 71d69 < + $headers = $variables['header']; 73,74d70 < + // Empty message. < + // Set to new variable for convenient checks later. 75a72 > + 80c77,78 < + // @todo API change, rename this variable from 'empty' to 'empty_message'. --- > > - // Check if we're dealing with a simple or complex column 83,105d80 < + // Preprocess header. < + if (!empty($variables['header'])) { < + // Add sticky headers, if applicable. < + if ($is_sticky) { < + drupal_add_library('system', 'drupal.tableheader'); < + // Add 'sticky-enabled' class to the table to identify it for JS. < + // This is needed to target tables constructed by this function. < + $variables['attributes']['class'][] = 'sticky-enabled'; < + } < + < + // If the table has headers and it should react responsively to columns < + // hidden with the classes represented by the constants < + // RESPONSIVE_PRIORITY_MEDIUM and RESPONSIVE_PRIORITY_LOW, add the < + // tableresponsive behaviors. < + if ($is_responsive) { < + drupal_add_library('system', 'drupal.tableresponsive'); < + // Add 'responsive-enabled' class to the table to identify it for JS. < + // This is needed to target tables constructed by this function. < + $variables['attributes']['class'][] = 'responsive-enabled'; < + } < + } < + < + // Preprocess colgroups. 110c85 < + // Support simple or complex colgroups. --- > + // Support simple and complex colgroups. 122c97 < @@ -2144,25 +2157,26 @@ function theme_table($variables) { --- > @@ -2196,25 +2184,24 @@ function theme_table($variables) { 132d106 < + // Set colgroup attributes. 135c109 < + // Set cols. --- > + // Build colgroups and assign attributes 152d125 < + // Preprocess Empty message. 154c127 < + // data rows and the empty message is set. --- > + // data rows and the empty message is not empty. 162c135 < @@ -2170,96 +2184,174 @@ function theme_table($variables) { --- > @@ -2222,96 +2209,172 @@ function theme_table($variables) { 168,170d140 < + // @todo Leave rows empty, let template decide how to handle no rows, using < + // empty_message variable and optionally counting the columns to generate < + // an "empty" row spanning all columns like this. 190c160 < + // Build up an associative array of responsive classes keyed by column. --- > + // Build an associative array of responsive classes keyed by column. 195a166,179 > + // Add sticky headers, if applicable. > + if ($is_sticky) { > + drupal_add_library('system', 'drupal.tableheader'); > + // Add 'sticky-enabled' class to the table to identify it for JavaScript. > + $variables['attributes']['class'][] = 'sticky-enabled'; > + } > + > + // If the table is responsive, set a class and add the necessary library. > + if ($is_responsive) { > + drupal_add_library('system', 'drupal.tableresponsive'); > + // Add 'responsive-enabled' class to the table to identify it for JavaScript. > + $variables['attributes']['class'][] = 'responsive-enabled'; > + } > + 200d183 < + 209d191 < + // Create cell attributes. 231,232d212 < + // @todo Find out why we can use $variables['header'] here but must use < + // $headers for tablesort_cell() below. 244d223 < + // Conversion to Attribute() happens last. 251,252d229 < + // @todo Make sure we're not overwriting or losing any header element < + // variables. 266d242 < + // Preprocess table rows. 308c284 < + // Add odd/even class --- > + // Add odd/even class. 313a290 > + // Build row. 315d291 < + // Build row. 322d297 < + 331d305 < + // Create cell attributes. 338,340c312 < + // @todo Find out why we can't use $variables['header'] instead of < + // $headers here while we can in tablesort_header() above. < + $cell = tablesort_cell($cell, $headers, $ts, $i); --- > + $cell = tablesort_cell($cell, $variables['header'], $ts, $i); 361,362c333 < } < - $output .= _theme_table_cell($cell); --- > + } 364d334 < + // Conversion to Attribute() happens last. 370c340,341 < + } --- > } > - $output .= _theme_table_cell($cell); 387c358 < @@ -2567,47 +2659,6 @@ function theme_indentation($variables) { --- > @@ -2619,47 +2682,6 @@ function theme_indentation($variables) { 435c406 < @@ -3179,6 +3230,7 @@ function drupal_common_theme() { --- > @@ -3271,6 +3293,7 @@ function drupal_common_theme() { 444c415 < index eb2c1ec..6b2c365 100644 --- > index 1a5e009..8d05496 100644 455c426 < @@ -1104,7 +1105,12 @@ function template_preprocess_forum_topic_list(&$variables) { --- > @@ -1123,7 +1124,12 @@ function template_preprocess_forum_topic_list(&$variables) { 470c441 < index 0dbedd7..995e93a 100644 --- > index 0dbedd7..a235849 100644 490c461 < + * Tests that the 'header' option in cells works correctly --- > + * Tests that the 'header' option in cells works correctly.