From 0d276f2d73c8820e765f6e12630d728fae658cd4 Mon Sep 17 00:00:00 2001 From: Alex Pott Date: Tue, 7 Jul 2020 17:59:15 +0100 Subject: [PATCH] Issue #2848367 by mlncn, jp.stacey, kunalkursija: Render API overview example of placeholders either incorrect or misleading (cherry picked from commit 323a808bd0b7c7fd45921f4c2575fcc9109c40c1) --- core/lib/Drupal/Core/Render/theme.api.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/core/lib/Drupal/Core/Render/theme.api.php b/core/lib/Drupal/Core/Render/theme.api.php index 605c91b126..082f139f3c 100644 --- a/core/lib/Drupal/Core/Render/theme.api.php +++ b/core/lib/Drupal/Core/Render/theme.api.php @@ -414,13 +414,16 @@ * render array contained: * @code * $build['my_element'] = [ - * '#attached' => ['placeholders' => ['@foo' => 'replacement']], - * '#markup' => ['Something about @foo'], + * '#markup' => 'Something about @foo', + * '#attached' => [ + * 'placeholders' => [ + * '@foo' => ['#markup' => 'replacement'], + * ], * ]; * @endcode * then #markup would end up containing 'Something about replacement'. * - * Note that each placeholder value can itself be a render array, which will be + * Note that each placeholder value *must* itself be a render array. It will be * rendered, and any cache tags generated during rendering will be added to the * cache tags for the markup. * -- GitLab