function views_php_handler_filter::php_pre_render in Views PHP 7.2
See also
views_php_plugin_pager::render()
File
- plugins/
views/ views_php_handler_filter.inc, line 82
Class
- views_php_handler_filter
- A handler to filter a view using PHP defined by the administrator.
Code
function php_pre_render() {
// Evaluate the PHP code.
if (!empty($this->options['php_filter'])) {
$code = $this->options['php_filter'] . ';';
$function = function ($view, $handler, &$static, $row, $data) use ($code) {
return eval($code);
};
ob_start();
$normalized_row = new stdClass();
foreach ($this->view->result as $i => $result) {
foreach ($this->view->field as $id => $field) {
$normalized_row->{$id} = $this->view->field[$id]
->theme($result);
}
if ($function($this->view, $this, $this->php_static_variable, $normalized_row, $result)) {
unset($this->view->result[$i]);
}
}
ob_end_clean();
}
}