You are here

function tablesort_header in Drupal 8

Same name and namespace in other branches
  1. 4 includes/tablesort.inc \tablesort_header()
  2. 5 includes/tablesort.inc \tablesort_header()
  3. 6 includes/tablesort.inc \tablesort_header()
  4. 7 includes/tablesort.inc \tablesort_header()

Formats a column header.

If the cell in question is the column header for the current sort criterion, it gets special formatting. All possible sort criteria become links.

Parameters

string $cell_content: The cell content to format. Passed by reference.

array $cell_attributes: The cell attributes. Passed by reference.

array $header: An array of column headers in the format described in '#type' => 'table'.

array $ts: The current table sort context as returned from tablesort_init().

Deprecated

in drupal:8.7.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Utility\TableSort::header() instead.

See also

\Drupal\Core\Utility\TableSortInterface::header()

https://www.drupal.org/node/3009182

1 call to tablesort_header()
TableSortLegacyTest::testHeader in core/tests/Drupal/KernelTests/Core/Theme/TableSortLegacyTest.php
Tests deprecation of the tablesort_header() function.

File

core/includes/tablesort.inc, line 49
Functions to aid in the creation of sortable tables.

Code

function tablesort_header(&$cell_content, array &$cell_attributes, array $header, array $ts) {
  @trigger_error(__FUNCTION__ . '() is deprecated in Drupal 8.7.x and will be removed before Drupal 9.0.0. Use \\Drupal\\Core\\Utility\\TableSort::header() instead. See https://www.drupal.org/node/3009182', E_USER_DEPRECATED);
  TableSort::header($cell_content, $cell_attributes, $header, $ts);
}