function HelpTopicsSyntaxTest::renderHelpTopic
Same name in other branches
- 10 core/modules/help/tests/src/Functional/HelpTopicsSyntaxTest.php \Drupal\Tests\help\Functional\HelpTopicsSyntaxTest::renderHelpTopic()
- 11.x core/modules/help/tests/src/Functional/HelpTopicsSyntaxTest.php \Drupal\Tests\help\Functional\HelpTopicsSyntaxTest::renderHelpTopic()
Renders a help topic in a special manner.
Parameters
string $content: Template text, without the front matter.
string $manner: The special processing choice for topic rendering.
Return value
string The rendered topic.
1 call to HelpTopicsSyntaxTest::renderHelpTopic()
- HelpTopicsSyntaxTest::verifyTopic in core/
modules/ help_topics/ tests/ src/ Functional/ HelpTopicsSyntaxTest.php - Verifies rendering and standards compliance of one help topic.
File
-
core/
modules/ help_topics/ tests/ src/ Functional/ HelpTopicsSyntaxTest.php, line 333
Class
- HelpTopicsSyntaxTest
- Verifies that all core Help topics can be rendered and comply with standards.
Namespace
Drupal\Tests\help_topics\FunctionalCode
protected function renderHelpTopic(string $content, string $manner) {
// Set up the special state variables for rendering.
HelpTestTwigNodeVisitor::setStateValue('manner', $manner);
HelpTestTwigNodeVisitor::setStateValue('max_chunk', -1);
HelpTestTwigNodeVisitor::setStateValue('chunk_count', -1);
// Add a random comment to the end, to thwart caching, and render. We need
// the HelpTestTwigNodeVisitor class to hit it each time we render.
$build = [
'#type' => 'inline_template',
'#template' => $content . "\n{# " . rand() . " #}",
];
return (string) \Drupal::service('renderer')->renderPlain($build);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.