You are here

protected function ExtraFieldViewsPlugin::renderView in Entity Extra Field 8

Same name and namespace in other branches
  1. 2.0.x src/Plugin/ExtraFieldType/ExtraFieldViewsPlugin.php \Drupal\entity_extra_field\Plugin\ExtraFieldType\ExtraFieldViewsPlugin::renderView()

Render the view.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The view entity instance.

Return value

array|null An renderable array of the view.

Throws

\Drupal\Component\Plugin\Exception\PluginNotFoundException

1 call to ExtraFieldViewsPlugin::renderView()
ExtraFieldViewsPlugin::build in src/Plugin/ExtraFieldType/ExtraFieldViewsPlugin.php
Build the render array of the extra field type contents.

File

src/Plugin/ExtraFieldType/ExtraFieldViewsPlugin.php, line 120

Class

ExtraFieldViewsPlugin
Define extra field views plugin.

Namespace

Drupal\entity_extra_field\Plugin\ExtraFieldType

Code

protected function renderView(EntityInterface $entity) {
  $view_name = $this
    ->getViewName();
  if (!isset($view_name)) {
    return [];
  }
  $view_arguments = $this
    ->getViewArguments($entity);
  return views_embed_view($view_name, $this
    ->getViewDisplay(), ...$view_arguments);
}