function RendererPlaceholdersTest::generatePlaceholdersWithChildrenTestElement
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Render/RendererPlaceholdersTest.php \Drupal\Tests\Core\Render\RendererPlaceholdersTest::generatePlaceholdersWithChildrenTestElement()
- 8.9.x core/tests/Drupal/Tests/Core/Render/RendererPlaceholdersTest.php \Drupal\Tests\Core\Render\RendererPlaceholdersTest::generatePlaceholdersWithChildrenTestElement()
- 10 core/tests/Drupal/Tests/Core/Render/RendererPlaceholdersTest.php \Drupal\Tests\Core\Render\RendererPlaceholdersTest::generatePlaceholdersWithChildrenTestElement()
Generates an element with placeholders at 3 levels.
Parameters
array $args_1: The arguments for the placeholder at level 1.
array $args_2: The arguments for the placeholder at level 2.
array $args_3: The arguments for the placeholder at level 3.
Return value
array The generated render array for testing.
1 call to RendererPlaceholdersTest::generatePlaceholdersWithChildrenTestElement()
- RendererPlaceholdersTest::testRenderChildrenPlaceholdersDifferentArguments in core/
tests/ Drupal/ Tests/ Core/ Render/ RendererPlaceholdersTest.php - Tests the creation of an element with a child and a sub-child.
File
-
core/
tests/ Drupal/ Tests/ Core/ Render/ RendererPlaceholdersTest.php, line 1109
Class
- RendererPlaceholdersTest
- @coversDefaultClass \Drupal\Core\Render\Renderer @covers \Drupal\Core\Render\RenderCache @covers \Drupal\Core\Render\PlaceholderingRenderCache @group Render
Namespace
Drupal\Tests\Core\RenderCode
protected function generatePlaceholdersWithChildrenTestElement(array $args_1, array $args_2, array $args_3) : array {
$test_element = [
'#type' => 'details',
'#cache' => [
'keys' => [
'test',
'renderer',
'children_placeholders',
],
],
'#title' => 'Parent',
'#attached' => [
'drupalSettings' => [
'foo' => 'bar',
],
'placeholders' => [
'parent-x-parent' => [
'#lazy_builder' => [
__NAMESPACE__ . '\\PlaceholdersTest::callback',
$args_1,
],
],
],
],
];
$test_element['child'] = [
'#type' => 'details',
'#attached' => [
'placeholders' => [
'child-x-child' => [
'#lazy_builder' => [
__NAMESPACE__ . '\\PlaceholdersTest::callback',
$args_2,
],
],
],
],
'#title' => 'Child',
];
$test_element['child']['subchild'] = [
'#attached' => [
'placeholders' => [
'subchild-x-subchild' => [
'#lazy_builder' => [
__NAMESPACE__ . '\\PlaceholdersTest::callback',
$args_3,
],
],
],
],
'#markup' => 'Subchild',
];
return $test_element;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.