You are here

public static function DisplayPluginBase::buildBasicRenderable in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/views/src/Plugin/views/display/DisplayPluginBase.php \Drupal\views\Plugin\views\display\DisplayPluginBase::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

9 calls to DisplayPluginBase::buildBasicRenderable()
AccessPermissionTest::testRenderCaching in core/modules/user/src/Tests/Views/AccessPermissionTest.php
Tests access on render caching.
AccessRoleTest::testRenderCaching in core/modules/user/src/Tests/Views/AccessRoleTest.php
Tests access on render caching.
AssertViewsCacheTagsTrait::assertViewsCacheTagsFromStaticRenderArray in core/modules/views/src/Tests/AssertViewsCacheTagsTrait.php
Asserts a view's result & render cache items' cache tags.
CacheWebTest::testCacheOutputOnPage in core/modules/views/src/Tests/Plugin/CacheWebTest.php
Tests the output caching on an actual page.
Feed::buildResponse in core/modules/views/src/Plugin/views/display/Feed.php
Builds up a response with the rendered view as content.

... See full list

1 method overrides DisplayPluginBase::buildBasicRenderable()
Page::buildBasicRenderable in core/modules/views/src/Plugin/views/display/Page.php
Builds a basic render array which can be properly render cached.

File

core/modules/views/src/Plugin/views/display/DisplayPluginBase.php, line 2359
Contains \Drupal\views\Plugin\views\display\DisplayPluginBase.

Class

DisplayPluginBase
Base class for views display plugins.

Namespace

Drupal\views\Plugin\views\display

Code

public static function buildBasicRenderable($view_id, $display_id, array $args = []) {
  $build = [
    '#type' => 'view',
    '#name' => $view_id,
    '#display_id' => $display_id,
    '#arguments' => $args,
    '#embed' => FALSE,
    '#cache' => [
      'keys' => [
        'view',
        $view_id,
        'display',
        $display_id,
      ],
    ],
  ];
  if ($args) {
    $build['#cache']['keys'][] = 'args';
    $build['#cache']['keys'][] = implode(',', $args);
  }
  $build['#cache_properties'] = [
    '#view_id',
    '#view_display_show_admin_links',
    '#view_display_plugin_id',
  ];
  return $build;
}