You are here

public function ViewsPhp::renderViewsPhp in Views PHP 8

Render a text area with PHP code.

1 call to ViewsPhp::renderViewsPhp()
ViewsPhp::render in src/Plugin/views/area/ViewsPhp.php
Render the area.

File

src/Plugin/views/area/ViewsPhp.php, line 62
Definition of Drupal\views_php\Plugin\views\area\ViewsPhp.

Class

ViewsPhp
Views area PHP text handler.

Namespace

Drupal\views_php\Plugin\views\area

Code

public function renderViewsPhp($value = FALSE) {

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