function views_php_handler_filter::query in Views PHP 6
Same name and namespace in other branches
- 7.2 plugins/views/views_php_handler_filter.inc \views_php_handler_filter::query()
- 7 plugins/views/views_php_handler_filter.inc \views_php_handler_filter::query()
Implements views_handler_filter#query().
File
- plugins/
views/ views_php_handler_filter.inc, line 62
Class
- views_php_handler_filter
- A handler to filter 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_filter'])) {
$function = create_function('$view, $handler, &$static', $this->options['sql_filter'] . ';');
ob_start();
$clause = $function($this->view, $this, $this->php_static_variable);
ob_end_clean();
if (!empty($clause)) {
$this->query
->add_where($this->options['group'], $clause);
}
}
}