You are here

function theme_theme_test_render_element_children in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/system/tests/modules/theme_legacy_test/theme_legacy_test.module \theme_theme_test_render_element_children()

Theme function for testing rendering of child elements via drupal_render().

Theme hooks defining a 'render element' add an internal '#render_children' property. When this property is found, drupal_render() avoids calling the 'theme.manager' service 'render' method on the top-level element to prevent infinite recursion.

Parameters

array $variables: An associative array containing:

  • element: An associative array containing the properties of the element.
1 string reference to 'theme_theme_test_render_element_children'
theme_legacy_test_theme in core/modules/system/tests/modules/theme_legacy_test/theme_legacy_test.module
Implements hook_theme().
2 theme calls to theme_theme_test_render_element_children()
RenderTest::testRenderChildren in core/tests/Drupal/KernelTests/Core/Render/RenderTest.php
Ensures that render array children are processed correctly.
ThemeTest::testDrupalRenderChildren in core/modules/system/tests/src/Kernel/Theme/ThemeTest.php
Tests child element rendering for 'render element' theme hooks.

File

core/modules/system/tests/modules/theme_legacy_test/theme_legacy_test.module, line 77
Test module for legacy theme functions.

Code

function theme_theme_test_render_element_children($variables) {
  return \Drupal::service('renderer')
    ->render($variables['element']);
}