function AssertBreadcrumbTrait::getBreadcrumbParts

Same name in other branches
  1. 9 core/modules/system/tests/src/Functional/Menu/AssertBreadcrumbTrait.php \Drupal\Tests\system\Functional\Menu\AssertBreadcrumbTrait::getBreadcrumbParts()
  2. 8.9.x core/modules/system/src/Tests/Menu/AssertBreadcrumbTrait.php \Drupal\system\Tests\Menu\AssertBreadcrumbTrait::getBreadcrumbParts()
  3. 8.9.x core/modules/system/tests/src/Functional/Menu/AssertBreadcrumbTrait.php \Drupal\Tests\system\Functional\Menu\AssertBreadcrumbTrait::getBreadcrumbParts()
  4. 10 core/modules/system/tests/src/Functional/Menu/AssertBreadcrumbTrait.php \Drupal\Tests\system\Functional\Menu\AssertBreadcrumbTrait::getBreadcrumbParts()

Returns the breadcrumb contents of the current page in the internal browser.

1 call to AssertBreadcrumbTrait::getBreadcrumbParts()
AssertBreadcrumbTrait::assertBreadcrumbParts in core/modules/system/tests/src/Functional/Menu/AssertBreadcrumbTrait.php
Assert that a trail exists in the internal browser.

File

core/modules/system/tests/src/Functional/Menu/AssertBreadcrumbTrait.php, line 113

Class

AssertBreadcrumbTrait
Provides test assertions for verifying breadcrumbs.

Namespace

Drupal\Tests\system\Functional\Menu

Code

protected function getBreadcrumbParts() : array {
    $parts = [];
    $elements = $this->xpath('//nav[@aria-labelledby="system-breadcrumb"]//ol/li/a');
    if (!empty($elements)) {
        foreach ($elements as $element) {
            $parts[] = [
                'text' => $element->getText(),
                'href' => $element->getAttribute('href'),
                'title' => $element->getAttribute('title'),
            ];
        }
    }
    return $parts;
}

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