function AreaDisplayLinkTest::renderDisplayLink

Same name in other branches
  1. 9 core/modules/views/tests/src/Kernel/Handler/AreaDisplayLinkTest.php \Drupal\Tests\views\Kernel\Handler\AreaDisplayLinkTest::renderDisplayLink()
  2. 8.9.x core/modules/views/tests/src/Kernel/Handler/AreaDisplayLinkTest.php \Drupal\Tests\views\Kernel\Handler\AreaDisplayLinkTest::renderDisplayLink()
  3. 11.x 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 368

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

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