function Table::buildSort

Same name in other branches
  1. 9 core/modules/views/src/Plugin/views/style/Table.php \Drupal\views\Plugin\views\style\Table::buildSort()
  2. 8.9.x core/modules/views/src/Plugin/views/style/Table.php \Drupal\views\Plugin\views\style\Table::buildSort()
  3. 11.x core/modules/views/src/Plugin/views/style/Table.php \Drupal\views\Plugin\views\style\Table::buildSort()

Overrides StylePluginBase::buildSort

File

core/modules/views/src/Plugin/views/style/Table.php, line 85

Class

Table
Style plugin to render each item as a row in a table.

Namespace

Drupal\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']);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.