public TableSortExtender::orderByHeader(array $header)
Order the query based on a header array.
array $header: Table header array.
\Drupal\Core\Database\Query\SelectInterface The called object.
public function orderByHeader(array $header) { $this->header = $header; $ts = $this->init(); if (!empty($ts['sql'])) { // Based on code from db_escape_table(), but this can also contain a dot. $field = preg_replace('/[^A-Za-z0-9_.]+/', '', $ts['sql']); // orderBy() will ensure that only ASC/DESC values are accepted, so we // don't need to sanitize that here. $this->orderBy($field, $ts['sort']); } return $this; }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Database!Query!TableSortExtender.php/function/TableSortExtender::orderByHeader/8.1.x