You are here

function tablesort_init in Drupal 8

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

Initializes the table sort context.

Deprecated

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

See also

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

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

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

File

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

Code

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