You are here

public function ViewEmbed::buildRenderArray in Dashboards with Layout Builder 2.0.x

Same name and namespace in other branches
  1. 8 src/Plugin/Dashboard/ViewEmbed.php \Drupal\dashboards\Plugin\Dashboard\ViewEmbed::buildRenderArray()

Build render array.

Parameters

array $configuration: Plugin configuration.

Return value

array Return render array.

Overrides DashboardBase::buildRenderArray

File

src/Plugin/Dashboard/ViewEmbed.php, line 56

Class

ViewEmbed
Show account info.

Namespace

Drupal\dashboards\Plugin\Dashboard

Code

public function buildRenderArray($configuration) : array {
  $viewId = explode(':', $configuration['view']);
  $view = Views::getView($viewId[0]);
  if (!$view) {
    return [
      '#markup' => 'View do not exist anymore',
    ];
  }
  return views_embed_view($viewId[0], $viewId[1]);
}