function ViewsTestRenderCacheController::double

Same name in other branches
  1. 9 core/modules/views/tests/modules/views_test_render_cache/src/Controller/ViewsTestRenderCacheController.php \Drupal\views_test_render_cache\Controller\ViewsTestRenderCacheController::double()
  2. 10 core/modules/views/tests/modules/views_test_render_cache/src/Controller/ViewsTestRenderCacheController.php \Drupal\views_test_render_cache\Controller\ViewsTestRenderCacheController::double()

Returns the same block rendered twice with different arguments.

The view id. @var string $display_id The display id of display to be rendered twice. @var string $args_1 Comma-separated args to use in the first rendering. @var string $args_2 Comma-separated args to use in the second rendering.

Return value

array A renderable array.

1 string reference to 'ViewsTestRenderCacheController::double'
views_test_render_cache.routing.yml in core/modules/views/tests/modules/views_test_render_cache/views_test_render_cache.routing.yml
core/modules/views/tests/modules/views_test_render_cache/views_test_render_cache.routing.yml

File

core/modules/views/tests/modules/views_test_render_cache/src/Controller/ViewsTestRenderCacheController.php, line 30

Class

ViewsTestRenderCacheController
Provides route responses.

Namespace

Drupal\views_test_render_cache\Controller

Code

public function double(string $view_id, string $display_id, string $args_1, string $args_2) {
    $build = [];
    $view = Views::getView($view_id);
    $build[] = $view->buildRenderable($display_id, explode(",", $args_1));
    $view = Views::getView($view_id);
    $build[] = $view->buildRenderable($display_id, explode(",", $args_2));
    return $build;
}

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