commit a0510d72eaf1a56115db15a52da062895fac79ef Author: Joel Pittet Date: Wed Jun 5 20:17:20 2013 -0700 empty revert and whitespace/line length cleanup diff --git a/core/includes/theme.inc b/core/includes/theme.inc index 7ffb0d5..a345965 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -2076,25 +2076,15 @@ function template_preprocess_table(&$variables) { // Flags. $is_sticky = !empty($variables['sticky']); $is_responsive = !empty($variables['responsive']); - $variables['attributes'] = new Attribute($variables['attributes']); // Table header. if (!empty($variables['header']) && is_array($variables['header'])) { $variables['header'] = array_values($variables['header']); } - $empty_message = (isset($variables['empty'])) ? $variables['empty'] : ''; - - // Remove 'empty' from template variables and set message to its own variable - // to make sure we don't conflict with Twig's reserved keyword of the same - // name. - unset($variables['empty']); - - $variables['empty_message'] = $empty_message; - if (!empty($variables['colgroups'])) { foreach ($variables['colgroups'] as $colgroup_key => $colgroup) { - $colgroup_attributes = new Attribute(array()); + $colgroup_attributes = new Attribute(); // Support simple and complex colgroups. if (isset($colgroup['data'])) { @@ -2125,8 +2115,8 @@ function template_preprocess_table(&$variables) { } // Add one row spanning all columns for the 'empty' message if there are no - // data rows and the empty message is not empty. - if (empty($variables['rows']) && !empty($empty_message)) { + // data rows and the empty message is set. + if (empty($variables['rows']) && isset($variables['empty'])) { $header_count = 0; foreach ($variables['header'] as $header_cell) { if (is_array($header_cell)) { @@ -2138,7 +2128,7 @@ function template_preprocess_table(&$variables) { } // Add one row for the empty message spanning all columns. $variables['rows'][] = array(array( - 'data' => $empty_message, + 'data' => $variables['empty'], 'attributes' => new Attribute(array( 'colspan' => $header_count, 'class' => array('empty', 'message'), @@ -2162,7 +2152,8 @@ function template_preprocess_table(&$variables) { // 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. + // Add 'responsive-enabled' class to the table to identify it + // for JavaScript. $variables['attributes']['class'][] = 'responsive-enabled'; } @@ -2274,8 +2265,8 @@ function template_preprocess_table(&$variables) { // Add active class if needed for sortable tables. $cell = tablesort_cell($cell, $variables['header'], $ts, $i); - // Move cell properties that are not data, attributes or header property - // into attributes. + // Move cell properties that are not data, attributes or header + // property into attributes. foreach ($cell as $key => $value) { if ($key != 'data' && $key != 'attributes' && $key != 'header') { $cell['attributes'][$key] = $value; diff --git a/core/modules/system/templates/table.html.twig b/core/modules/system/templates/table.html.twig index 031e9a2..8552f47 100644 --- a/core/modules/system/templates/table.html.twig +++ b/core/modules/system/templates/table.html.twig @@ -28,8 +28,8 @@ * - header: Indicates this cell is a header. * - attributes: Any HTML attributes, such as "colspan", to apply to the * table cell. - * - empty_message: The message to display in an extra row if table does not - * have any rows. + * - empty: The message to display in an extra row if table does not have + * any rows. * * @see template_preprocess() * @see template_preprocess_table() @@ -62,7 +62,7 @@ {% for cell in header -%} - {{- cell.data -}} + {{- cell.data -}} {%- endfor %} @@ -77,7 +77,7 @@ {% for cell in row.cells -%} {%- set cell_tag = cell.header ? 'th' : 'td' -%} <{{ cell_tag }}{{ cell.attributes }}> - {{- cell.data -}} + {{- cell.data -}} {%- endfor %}