public function DataExport::buildSortPost in Views data export 8
Called by the view builder to let the style build a second set of sorts that will come after any other sorts in the view.
Overrides StylePluginBase::buildSortPost
File
- src/
Plugin/ views/ style/ DataExport.php, line 212
Class
- DataExport
- A style plugin for data export views.
Namespace
Drupal\views_data_export\Plugin\views\styleCode
public function buildSortPost() {
$query = $this->view
->getRequest()->query;
$sort_field = $query
->get('order');
if (empty($sort_field) || empty($this->view->field[$sort_field])) {
return;
}
// Ensure sort order is valid.
$sort_order = strtolower($query
->get('sort'));
if (empty($sort_order) || $sort_order != 'asc' && $sort_order != 'desc') {
$sort_order = 'asc';
}
// Tell the field to click sort.
$this->view->field[$sort_field]
->clickSort($sort_order);
}