function TableSort::getContextFromRequest
Initializes the table sort context.
Parameters
array $headers: An array of column headers in the format described in '#type' => 'table'.
\Symfony\Component\HttpFoundation\Request $request: A current request.
Return value
array The current table sort context.
3 calls to TableSort::getContextFromRequest()
- TableSortExtender::orderByHeader in core/lib/ Drupal/ Core/ Database/ Query/ TableSortExtender.php 
- Order the query based on a header array.
- TableSortExtenderTest::testTableSortInit in core/tests/ Drupal/ KernelTests/ Core/ Render/ Element/ TableSortExtenderTest.php 
- Tests \Drupal\Core\Utility\TableSort::getContextFromRequest().
- template_preprocess_table in core/includes/ theme.inc 
- Prepares variables for table templates.
File
- 
              core/lib/ Drupal/ Core/ Utility/ TableSort.php, line 30 
Class
- TableSort
- Provides a class for table sorting processing and rendering.
Namespace
Drupal\Core\UtilityCode
public static function getContextFromRequest(array $headers, Request $request) {
  $context = static::getOrder($headers, $request);
  $context['sort'] = static::getSort($headers, $request);
  $context['query'] = static::getQueryParameters($request);
  return $context;
}Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.
