diff --git a/core/includes/theme.inc b/core/includes/theme.inc index ad4ed5f..552f870 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -2093,9 +2093,10 @@ function template_preprocess_table(&$variables) { // Table headers. (Drupal supports only one, that's why it's called 'header'). // Headers needed for reference of active sorting - // header after it's cells are processed + // header after its cells are processed // array_values indexes for the table sort to work - // @todo: Clarify why this variable is used or fix to use variables['header'] directly. + // @todo Clarify why this variable is used or fix to use variables['header'] + // directly. if (!empty($variables['header']) && is_array($variables['header'])) { $variables['header'] = array_values($variables['header']); } @@ -2104,10 +2105,11 @@ function template_preprocess_table(&$variables) { // Empty message. // Set to new variable for convenient checks later. $empty_message = (isset($variables['empty'])) ? $variables['empty'] : ''; - // Remove 'empty' from template variables and set message to it's own variable - // to make sure we don't conflict with Twig's reserved keyword of the same name. + // 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']); - // @todo: API change, rename this variable from 'empty' to 'empty_message'. + // @todo API change, rename this variable from 'empty' to 'empty_message'. $variables['empty_message'] = $empty_message; // Preprocess header. @@ -2120,9 +2122,10 @@ function template_preprocess_table(&$variables) { $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 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. @@ -2179,9 +2182,9 @@ function template_preprocess_table(&$variables) { } } // Add one row for the empty message spanning all columns. - // @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. + // @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. $variables['rows'][] = array(array( 'data' => $empty_message, 'attributes' => new Attribute(array( @@ -2210,7 +2213,7 @@ function template_preprocess_table(&$variables) { ); } - // Create cell attributes + // Create cell attributes. if (!isset($cell['attributes'])) { $cell['attributes'] = array(); } @@ -2228,12 +2231,13 @@ function template_preprocess_table(&$variables) { } } - // @todo: Find out why we can use $variables['header'] here but must use - // $headers for tablesort_cell() below. + // @todo Find out why we can use $variables['header'] here but must use + // $headers for tablesort_cell() below. $cell = tablesort_header($cell, $variables['header'], $ts); // Move cell properties that are not data or attributes into attributes. - // Doing this after tablesort_header as it removes its sort and field values. + // Doing this after tablesort_header as it removes its sort and field + // values. foreach ($cell as $key => $value) { if ($key != 'data' && $key != 'attributes') { $cell['attributes'][$key] = $value; @@ -2247,8 +2251,8 @@ function template_preprocess_table(&$variables) { $cell['header'] = TRUE; // Update the header cell with attributes and properties. - // @todo: Make sure we're not overwriting or losing any header element - // variables. + // @todo Make sure we're not overwriting or losing any header element + // variables. $variables['header'][$col_key] = $cell; } } @@ -2260,7 +2264,7 @@ function template_preprocess_table(&$variables) { if (!empty($variables['rows'])) { // Add odd/even class. - // @todo replace this because zebras are for the zoo. + // @todo Replace this because zebras are for the zoo. // @see http://drupal.org/node/1649780 $flip = array( 'even' => 'odd', @@ -2290,7 +2294,7 @@ function template_preprocess_table(&$variables) { } // Add odd/even class. - // @todo replace this because zebras are for the zoo. + // @todo Replace this because zebras are for the zoo. // @see http://drupal.org/node/1649780 if (empty($row['no_striping'])) { $class = $flip[$class]; @@ -2313,14 +2317,14 @@ function template_preprocess_table(&$variables) { ); } - // Create cell attributes + // Create cell attributes. if (!isset($cell['attributes'])) { $cell['attributes'] = array(); } // Add active class if needed for sortable tables. - // @todo: Find out why we can't use $variables['header'] - // instead of $headers here while we can in tablesort_header() above. + // @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); // Move cell properties that are not data or attributes into @@ -2340,7 +2344,7 @@ function template_preprocess_table(&$variables) { // Conversion to Attribute() happens last. $cell['attributes'] = new Attribute($cell['attributes']); - // Make sure that 0's get printed as '0'. + // Make sure that zeros get printed as '0'. if (isset($cell['data']) && is_int($cell['data'])) { $cell['data'] = (string) $cell['data']; } diff --git a/core/modules/forum/forum.module b/core/modules/forum/forum.module index fbc0187..801fe8d 100644 --- a/core/modules/forum/forum.module +++ b/core/modules/forum/forum.module @@ -1093,7 +1093,7 @@ function template_preprocess_forum_topic_list(&$variables) { $header = ''; foreach ($forum_topic_list_header as $cell) { $cell = tablesort_header($cell, $forum_topic_list_header, $ts); - // @todo take care of this in convert to #type=>table + // @todo Take care of this in the conversion to #type => table. // @see http://drupal.org/node/1938906. $_cell = $cell; unset($_cell['data']); diff --git a/core/modules/system/templates/table.html.twig b/core/modules/system/templates/table.html.twig index 31d2eac..f54fc33 100644 --- a/core/modules/system/templates/table.html.twig +++ b/core/modules/system/templates/table.html.twig @@ -8,26 +8,28 @@ * - caption: A localized string for the tag. * - colgroups: Column groups. Each group contains the following properties: * - attributes: HTML attributes to apply to the tag. - * // Note: Drupal currently supports only one table header row. - * // @see http://drupal.org/node/893530 - * // @see http://api.drupal.org/api/drupal/includes!theme.inc/function/theme_table/7#comment-5109 + * Note: Drupal currently supports only one table header row, see + * http://drupal.org/node/893530 and + * http://api.drupal.org/api/drupal/includes!theme.inc/function/theme_table/7#comment-5109. * - header: Table header cells. Each cell contains the following properties: * - attributes: HTML attributes to apply to the tag. * - data: A localized string for the title of the column. * - field: Field name (required for column sorting). * - sort: Default sort order for this column ("asc" or "desc"). - * - sticky: A boolean flag indicating whether to use a "sticky" table header. + * - sticky: A flag indicating whether to use a "sticky" table header. * - rows: Table rows. Each row contains the following properties: * - attributes: HTML attributes to apply to the tag. * - data: Table cells. - * - no_striping: a flag indicating that the row should receive no - * 'even / odd' styling. Defaults to FALSE. // @todo: Deprecate no_striping? + * - no_striping: A flag indicating that the row should receive no + * 'even / odd' styling. Defaults to FALSE. + * @todo Deprecate no_striping? * A cell can be either a string or may contain the following keys: * - data: The string to display in the table cell. * - header: Indicates this cell is a header. - * - attributes: Any html attributes, such as "colspan", to apply to the + * - 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_message: The message to display in an extra row if table does not + * have any rows. * * @see template_preprocess() * @see template_preprocess_table()