public function views_matrix_plugin_style_matrix::query in Views Matrix 7
Same name and namespace in other branches
- 8 includes/views_matrix_plugin_style_matrix.inc \views_matrix_plugin_style_matrix::query()
Add anything to the query that we might need to.
Overrides views_plugin_style::query
File
- includes/
views_matrix_plugin_style_matrix.inc, line 296 - Class definition for views matrix plugin.
Class
- views_matrix_plugin_style_matrix
- @class Views Plugin Class
Code
public function query() {
parent::query();
// To avoid problems with the Views output cache, we need to incorporate our
// own (dynamic) sorting information into the query.
if ($this->options['sortable_headers'] && !empty($_GET['order'])) {
$sort = $_GET['order'] . ',';
if (!isset($_GET['sort'])) {
$sort .= $this->options['header_init_sort'];
}
else {
$sort .= $_GET['sort'];
}
$query = $this->view->query;
if ($query instanceof views_plugin_query_default) {
$args = array(
':empty' => '',
':views_matrix_sort' => $sort,
);
$query
->add_where_expression(0, ':empty <> :views_matrix_sort', $args);
}
elseif ($query instanceof SearchApiViewsQuery) {
$query
->setOption('views_matrix_sort', $sort);
}
}
}