EntityFieldQuery::tableSort
public function EntityFieldQuery::tableSort
public EntityFieldQuery::tableSort(&$headers)
Enables sortable tables for this query.
Parameters
$headers: An EFQ Header array based on which the order clause is added to the query.
Return value
EntityFieldQuery The called object.
File
- includes/entity.inc, line 1069
Class
- EntityFieldQuery
- Retrieves entities matching a given set of conditions.
Code
public function tableSort(&$headers) { // If 'field' is not initialized, the header columns aren't clickable foreach ($headers as $key => $header) { if (is_array($header) && isset($header['specifier'])) { $headers[$key]['field'] = ''; } } $order = tablesort_get_order($headers); $direction = tablesort_get_sort($headers); foreach ($headers as $header) { if (is_array($header) && ($header['data'] == $order['name'])) { if ($header['type'] == 'field') { $this->fieldOrderBy($header['specifier']['field'], $header['specifier']['column'], $direction); } else { $header['direction'] = $direction; $this->order[] = $header; } } } 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/includes!entity.inc/function/EntityFieldQuery::tableSort/7.x