You are here

public function Recipe::preview in Recipe 8.2

Renders the display for the purposes of a live preview.

Also might be used for some other AJAXy reason.

Overrides DisplayPluginBase::preview

File

src/Plugin/views/display/Recipe.php, line 132

Class

Recipe
The plugin that handles a recipe format, such as RecipeML.

Namespace

Drupal\recipe\Plugin\views\display

Code

public function preview() {
  $output = $this->view
    ->render();
  if (!empty($this->view->live_preview)) {
    $output = [
      '#prefix' => '<pre>',
      '#plain_text' => $this->renderer
        ->renderRoot($output),
      '#suffix' => '</pre>',
    ];
  }
  return $output;
}