function DisplayPluginBase::buildBasicRenderable

Same name in other branches
  1. 9 core/modules/views/src/Plugin/views/display/DisplayPluginBase.php \Drupal\views\Plugin\views\display\DisplayPluginBase::buildBasicRenderable()
  2. 8.9.x core/modules/views/src/Plugin/views/display/DisplayPluginBase.php \Drupal\views\Plugin\views\display\DisplayPluginBase::buildBasicRenderable()
  3. 11.x core/modules/views/src/Plugin/views/display/DisplayPluginBase.php \Drupal\views\Plugin\views\display\DisplayPluginBase::buildBasicRenderable()

Overrides DisplayPluginInterface::buildBasicRenderable

9 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.
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 2440

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.