You are here

public function views_php_handler_field::php_pre_execute in Views PHP 7

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

See also

views_php_views_pre_execute()

self::php_post_execute()

File

plugins/views/views_php_handler_field.inc, line 114

Class

views_php_handler_field
A handler to provide a field that is constructed by the administrator using PHP.

Code

public function php_pre_execute() {

  // Execute static PHP code.
  if (!empty($this->options['php_setup'])) {
    $code = $this->options['php_setup'] . ';';
    $function = function ($view, $handler, &$static) use ($code) {
      eval($code);
    };
    ob_start();
    $function($this->view, $this, $this->php_static_variable);
    ob_end_clean();
  }
}