You are here

public function ViewsTestRenderCacheController::double in Drupal 9

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 28

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