Commit d24526e2 authored by catch's avatar catch
Browse files

docs: #3551942 Exception when using a closure in #pre_render

By: prudloff
By: larowlan
(cherry picked from commit 28517aad)
parent ee6a26c4
Loading
Loading
Loading
Loading
Loading
+2
Changes for core/lib/Drupal/Core/Render/Element/ElementInterface.php: 2 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -13,6 +13,8 @@
 * properties specified in render arrays. Thus, you can specify defaults for any
 * Render API keys, in addition to those explicitly documented by
 * \Drupal\Core\Render\ElementInfoManagerInterface::getInfo().
 * These defaults will be serialized so they should not contain closures or
 * anonymous functions.
 *
 * Some render elements are specifically form input elements; see
 * \Drupal\Core\Render\Element\FormElementInterface for more information.
+5
Changes for core/lib/Drupal/Core/Render/Element/RenderElementBase.php: 5 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -36,6 +36,10 @@
 * of type string, they would generally end up being
 * \Drupal\Core\StringTranslation\TranslatableMarkup objects instead.
 *
 * For properties containing callables it is not recommended to use a closure
 * or anonymous function because it will trigger an error if the element is
 * serialized. Examples in which serializing occurs include form caching.
 *
 * Here is the list of the properties used during the rendering of all render
 * elements:
 * - #access: (bool or AccessResultInterface)
@@ -124,6 +128,7 @@
 * @see \Drupal\Core\Render\ElementInterface
 * @see \Drupal\Core\Render\ElementInfoManager
 * @see plugin_api
 * @see \Drupal\Core\Form\FormState::setCached()
 *
 * @ingroup theme_render
 */
+2
Changes for core/lib/Drupal/Core/Render/theme.api.php: 2 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -857,6 +857,8 @@ function hook_render_template($template_file, $variables): string|\Stringable {
 * @param array $info
 *   An associative array with structure identical to that of the return value
 *   of \Drupal\Core\Render\ElementInfoManagerInterface::getInfo().
 *   This array will be serialized so it should not contain closures or
 *   anonymous functions.
 *
 * @see \Drupal\Core\Render\ElementInfoManager
 * @see \Drupal\Core\Render\Element\ElementInterface