function BookTestTrait::generateOutlinePattern
Same name in other branches
- 8.9.x core/modules/book/tests/src/Functional/BookTestTrait.php \Drupal\Tests\book\Functional\BookTestTrait::generateOutlinePattern()
- 10 core/modules/book/tests/src/Functional/BookTestTrait.php \Drupal\Tests\book\Functional\BookTestTrait::generateOutlinePattern()
- 11.x core/modules/book/tests/src/Functional/BookTestTrait.php \Drupal\Tests\book\Functional\BookTestTrait::generateOutlinePattern()
Creates a regular expression to check for the sub-nodes in the outline.
Parameters
array $nodes: An array of nodes to check in outline.
Return value
string A regular expression that locates sub-nodes of the outline.
1 call to BookTestTrait::generateOutlinePattern()
- BookTestTrait::checkBookNode in core/
modules/ book/ tests/ src/ Functional/ BookTestTrait.php - Checks the outline of sub-pages; previous, up, and next.
File
-
core/
modules/ book/ tests/ src/ Functional/ BookTestTrait.php, line 158
Class
- BookTestTrait
- Provides common functionality for Book test classes.
Namespace
Drupal\Tests\book\FunctionalCode
public function generateOutlinePattern($nodes) {
$outline = '';
foreach ($nodes as $node) {
$outline .= '(node\\/' . $node->id() . ')(.*?)(' . $node->label() . ')(.*?)';
}
return '/<nav role="navigation" aria-labelledby="book-label-' . $this->book
->id() . '"(.*?)<ul(.*?)' . $outline . '<\\/ul>/s';
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.