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

Determines the current sort direction.

Parameters

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

Return value

The current sort direction ("asc" or "desc").

Deprecated

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

See also

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

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

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

File

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

Code

function tablesort_get_sort($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::getSort() instead. See https://www.drupal.org/node/3009182', E_USER_DEPRECATED);
  return TableSort::getSort($headers, \Drupal::request());
}