You are here

function views_php_handler_area::render in Views PHP 7.2

Same name and namespace in other branches
  1. 6 plugins/views/views_php_handler_area.inc \views_php_handler_area::render()
  2. 7 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 36

Class

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

Code

function render($empty = FALSE) {

  // Ecexute 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 '';
}