You are here

public static function Page::buildBasicRenderable in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/views/src/Plugin/views/display/Page.php \Drupal\views\Plugin\views\display\Page::buildBasicRenderable()
  2. 9 core/modules/views/src/Plugin/views/display/Page.php \Drupal\views\Plugin\views\display\Page::buildBasicRenderable()

Builds a basic render array which can be properly render cached.

In order to be rendered cached, it includes cache keys as well as the data required to load the view on cache misses.

Parameters

string $view_id: The view ID.

string $display_id: The display ID.

array $args: (optional) The view arguments.

Return value

array The view render array.

Overrides DisplayPluginInterface::buildBasicRenderable

2 calls to Page::buildBasicRenderable()
PageTest::testBuildBasicRenderable in core/modules/views/tests/src/Unit/Plugin/display/PageTest.php
@covers ::buildBasicRenderable
PageTest::testBuildBasicRenderableWithMissingRoute in core/modules/views/tests/src/Unit/Plugin/display/PageTest.php
@covers ::buildBasicRenderable

File

core/modules/views/src/Plugin/views/display/Page.php, line 173

Class

Page
The plugin that handles a full page.

Namespace

Drupal\views\Plugin\views\display

Code

public static function buildBasicRenderable($view_id, $display_id, array $args = [], Route $route = NULL) {
  $build = parent::buildBasicRenderable($view_id, $display_id, $args);
  if ($route) {
    $build['#view_id'] = $route
      ->getDefault('view_id');
    $build['#view_display_plugin_id'] = $route
      ->getOption('_view_display_plugin_id');
    $build['#view_display_show_admin_links'] = $route
      ->getOption('_view_display_show_admin_links');
  }
  else {
    throw new \BadFunctionCallException('Missing route parameters.');
  }
  return $build;
}