Problem/Motivation
\Drupal\render_example\Controller\RenderController::mainPage() completely rewrite the render array it would return to show the render array as string. That is not necessary, and it probably causes issues with tests.
Proposed resolution
Remove the following code.
$output = [];
// We are going to create a new output render array that pairs each
// example with a set of helper render arrays.
foreach (Element::children($build) as $key) {
if (isset($build[$key])) {
$output[$key] = [
'#theme' => 'render_example_array',
'description' => [
'#type' => 'markup',
'#markup' => $build[$key]['#description'] ?? '',
],
'rendered' => $build[$key],
'debug_value' => [
'#type' => 'markup',
'#markup' => htmlentities(json_encode($build[$key])),
],
];
}
}
foreach (Element::properties($build) as $key) {
$output[$key] = $build[$key];
}
(Clearly, the value returned must be changed.)
Comments
Comment #3
avpadernoComment #6
avpadernoComment #8
avpaderno