function views_php_handler_sort::query in Views PHP 6
Same name and namespace in other branches
- 7.2 plugins/views/views_php_handler_sort.inc \views_php_handler_sort::query()
- 7 plugins/views/views_php_handler_sort.inc \views_php_handler_sort::query()
Implements views_handler_sort#query().
File
- plugins/
views/ views_php_handler_sort.inc, line 54
Class
- views_php_handler_sort
- A handler to sort a view using PHP defined by the administrator.
Code
function query() {
// Inform views_php_views_pre_execute() to seize control over the query.
$this->view->views_php = TRUE;
// Add the SQL sort clause if any.
if (!empty($this->options['sql_sort'])) {
$function = create_function('$view, $handler, &$static', $this->options['sql_sort'] . ';');
ob_start();
$clause = $function($this->view, $this, $this->php_static_variable);
ob_end_clean();
if (!empty($clause)) {
$this->query
->add_orderby(NULL, NULL, '', $clause);
}
}
}