public static function TableSort::getContextFromRequest in Drupal 8
Same name and namespace in other branches
- 9 core/lib/Drupal/Core/Utility/TableSort.php \Drupal\Core\Utility\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.
4 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().
- tablesort_init in core/
includes/ tablesort.inc - Initializes the table sort context.
- 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;
}