You are here

public function views_php_handler_area::render in Views PHP 7

Same name and namespace in other branches
  1. 6 plugins/views/views_php_handler_area.inc \views_php_handler_area::render()
  2. 7.2 plugins/views/views_php_handler_area.inc \views_php_handler_area::render()

Implements views_handler_area#render().

Overrides views_handler_area::render

File

plugins/views/views_php_handler_area.inc, line 35

Class

views_php_handler_area
A handler to provide an area that is constructed by the administrator using PHP.

Code

public function render($empty = FALSE) {

  // Execute output PHP code.
  if ((!$empty || !empty($this->options['empty'])) && !empty($this->options['php_output'])) {
    $code = ' ?>' . $this->options['php_output'];
    $function = function ($view, $handler, $results) use ($code) {
      eval($code);
    };
    ob_start();
    $function($this->view, $this, $this->view->result);
    return ob_get_clean();
  }
  return '';
}