function HelpTestTwigNodeVisitor::setStateValue
Same name in other branches
- 9 core/modules/help_topics/tests/modules/help_topics_twig_tester/src/HelpTestTwigNodeVisitor.php \Drupal\help_topics_twig_tester\HelpTestTwigNodeVisitor::setStateValue()
- 10 core/modules/help/tests/modules/help_topics_twig_tester/src/HelpTestTwigNodeVisitor.php \Drupal\help_topics_twig_tester\HelpTestTwigNodeVisitor::setStateValue()
Sets state information.
Parameters
string $key: Key to set. Possible keys:
- manner: Type of special processing to do when rendering. Values:
- 0: No processing.
- remove_translated: Remove all translated text, HTML tags, and whitespace.
- replace_translated: Replace all translated text with dummy text.
- translated_chunk: Remove all translated text except one designated chunk (see return_chunk below).
- bare_body (or any other non-zero value): Remove variables, set statements, and Twig programming, but leave everything else intact.
- chunk_count: Current index of translated chunks. Reset to -1 before each rendering run. (Used internally by this class.)
- max_chunk: Maximum index of translated chunks. Reset to -1 before each rendering run.
- return_chunk: Chunk index to keep intact for translated_chunk processing. All others are removed.
$value: Value to set for $key.
3 calls to HelpTestTwigNodeVisitor::setStateValue()
- HelpTestTwigNodeVisitor::leaveNode in core/
modules/ help/ tests/ modules/ help_topics_twig_tester/ src/ HelpTestTwigNodeVisitor.php - HelpTopicsSyntaxTest::renderHelpTopic in core/
modules/ help/ tests/ src/ Functional/ HelpTopicsSyntaxTest.php - Renders a help topic in a special manner.
- HelpTopicsSyntaxTest::verifyTopic in core/
modules/ help/ tests/ src/ Functional/ HelpTopicsSyntaxTest.php - Verifies rendering and standards compliance of one help topic.
File
-
core/
modules/ help/ tests/ modules/ help_topics_twig_tester/ src/ HelpTestTwigNodeVisitor.php, line 175
Class
- HelpTestTwigNodeVisitor
- Defines a Twig node visitor for testing help topics.
Namespace
Drupal\help_topics_twig_testerCode
public static function setStateValue(string $key, $value) {
$state = \Drupal::state();
$values = $state->get(static::STATE_NAME, [
'manner' => 0,
]);
$values[$key] = $value;
$state->set(static::STATE_NAME, $values);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.