You are here

public function OAIPMH::render in Views OAI-PMH 8

Renders this display.

Overrides DisplayPluginBase::render

File

src/Plugin/views/display/OAIPMH.php, line 145

Class

OAIPMH
Plugin annotation @ViewsDisplay( id = "views_oai_pmh_display", title = @Translation("OAI-PMH Views"), help = @Translation("Provide a feed using the OAI-PMH protocol."), uses_route = TRUE, admin = @Translation("OAI-PMH Views"), …

Namespace

Drupal\views_oai_pmh\Plugin\views\display

Code

public function render() {
  $build = [];
  $build['#markup'] = $this->renderer
    ->executeInRenderContext(new RenderContext(), function () {
    return $this->view->style_plugin
      ->render();
  });
  $this->view->element['#cache_properties'][] = '#content_type';

  // Encode and wrap the output in a pre tag if this is for a live preview.
  if (!empty($this->view->live_preview)) {
    $build['#prefix'] = '<pre>';
    $build['#plain_text'] = $build['#markup'];
    $build['#suffix'] = '</pre>';
    unset($build['#markup']);
  }
  else {
    $build['#markup'] = ViewsRenderPipelineMarkup::create($build['#markup']);
  }
  parent::applyDisplayCacheabilityMetadata($build);
  return $build;
}