You are here

public function UIkitViewTable::buildSort in UIkit Components 8

Same name and namespace in other branches
  1. 8.3 uikit_views/src/Plugin/views/style/UIkitViewTable.php \Drupal\uikit_views\Plugin\views\style\UIkitViewTable::buildSort()
  2. 8.2 uikit_views/src/Plugin/views/style/UIkitViewTable.php \Drupal\uikit_views\Plugin\views\style\UIkitViewTable::buildSort()

Called by the view builder to see if this style handler wants to interfere with the sorts. If so it should build; if it returns any non-TRUE value, normal sorting will NOT be added to the query.

Overrides StylePluginBase::buildSort

File

uikit_views/src/Plugin/views/style/UIkitViewTable.php, line 96

Class

UIkitViewTable
Style plugin to render each item in a UIkit Table component.

Namespace

Drupal\uikit_views\Plugin\views\style

Code

public function buildSort() {
  $order = $this->view
    ->getRequest()->query
    ->get('order');
  if (!isset($order) && ($this->options['default'] == -1 || empty($this->view->field[$this->options['default']]))) {
    return TRUE;
  }

  // If a sort we don't know anything about gets through, exit gracefully.
  if (isset($order) && empty($this->view->field[$order])) {
    return TRUE;
  }

  // Let the builder know whether or not we're overriding the default sorts.
  return empty($this->options['override']);
}