You are here

function tablesort_get_order in Drupal 8

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

Determines the current sort criterion.

Parameters

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

Return value

An associative array describing the criterion, containing the keys:

  • "name": The localized title of the table column.
  • "sql": The name of the database field to sort on.

Deprecated

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

See also

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

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

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

File

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

Code

function tablesort_get_order($headers) {
  @trigger_error(__FUNCTION__ . '() is deprecated in Drupal 8.7.x and will be removed before Drupal 9.0.0. Use \\Drupal\\Core\\Utility\\TableSort::getOrder() instead. See https://www.drupal.org/node/3009182', E_USER_DEPRECATED);
  return TableSort::getOrder($headers, \Drupal::request());
}