You are here

protected function AreaDisplayLinkTest::renderDisplayLink in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/views/tests/src/Kernel/Handler/AreaDisplayLinkTest.php \Drupal\Tests\views\Kernel\Handler\AreaDisplayLinkTest::renderDisplayLink()
  2. 10 core/modules/views/tests/src/Kernel/Handler/AreaDisplayLinkTest.php \Drupal\Tests\views\Kernel\Handler\AreaDisplayLinkTest::renderDisplayLink()

Render a display link.

Parameters

\Drupal\views\ViewExecutable $view: The view to render the link for.

string $display_link_id: The display link ID to render.

Return value

string The rendered display link.

2 calls to AreaDisplayLinkTest::renderDisplayLink()
AreaDisplayLinkTest::assertRenderedDisplayLinks in core/modules/views/tests/src/Kernel/Handler/AreaDisplayLinkTest.php
Assert the display links are correctly rendered for a display.
AreaDisplayLinkTest::testAreaDisplayLink in core/modules/views/tests/src/Kernel/Handler/AreaDisplayLinkTest.php
Tests the views area display_link handler.

File

core/modules/views/tests/src/Kernel/Handler/AreaDisplayLinkTest.php, line 359

Class

AreaDisplayLinkTest
Tests the core views_handler_area_display_link handler.

Namespace

Drupal\Tests\views\Kernel\Handler

Code

protected function renderDisplayLink(ViewExecutable $view, $display_link_id) {

  /** @var \Drupal\Core\Render\RendererInterface $renderer */
  $renderer = $this->container
    ->get('renderer');
  $display_link = $view->display_handler
    ->getHandler('header', $display_link_id)
    ->render();
  return $renderer
    ->renderRoot($display_link)
    ->__toString();
}