function DisplayPluginBase::buildBasicRenderable

Same name and namespace in other branches
  1. 11.x core/modules/views/src/Plugin/views/display/DisplayPluginBase.php \Drupal\views\Plugin\views\display\DisplayPluginBase::buildBasicRenderable()
  2. 10 core/modules/views/src/Plugin/views/display/DisplayPluginBase.php \Drupal\views\Plugin\views\display\DisplayPluginBase::buildBasicRenderable()
  3. 8.9.x core/modules/views/src/Plugin/views/display/DisplayPluginBase.php \Drupal\views\Plugin\views\display\DisplayPluginBase::buildBasicRenderable()
6 calls to DisplayPluginBase::buildBasicRenderable()
AccessPermissionTest::testRenderCaching in core/modules/user/tests/src/Kernel/Views/AccessPermissionTest.php
Tests access on render caching.
AccessRoleTest::testRenderCaching in core/modules/user/tests/src/Functional/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/tests/src/Functional/Plugin/CacheWebTest.php
Tests the output caching on an actual page.
SortRandomTest::testRandomOrderingWithRenderCaching in core/modules/views/tests/src/Kernel/Handler/SortRandomTest.php
Tests random ordering with tags based caching.

... See full list

File

core/modules/views/src/Plugin/views/display/DisplayPluginBase.php, line 2432

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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.