public function JsonFeed::render in JSON Feed 8
Renders this display.
Overrides Feed::render
File
- src/
Plugin/ views/ display/ JsonFeed.php, line 120
Class
- JsonFeed
- The plugin that handles a JSON feed.
Namespace
Drupal\json_feed\Plugin\views\displayCode
public function render() {
$build = [];
$build['#markup'] = $this
->getRenderer()
->executeInRenderContext(new RenderContext(), function () {
return $this->view->style_plugin
->render();
});
$this->view->element['#content_type'] = $this->view
->getRequest()
->getMimeType('json');
// 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;
}