From b7439f4592964f8ebf57746ef90cc328a9dea966 Mon Sep 17 00:00:00 2001 From: Pierre <pierredureau@yahoo.fr> Date: Tue, 26 Nov 2024 23:21:02 +0100 Subject: [PATCH] Issue #3449653 by pdureau, just_like_good_vibes: Replace component() function by native include() function (follow-up) --- src/Element/ComponentElementAlter.php | 2 +- src/Template/TwigExtension.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Element/ComponentElementAlter.php b/src/Element/ComponentElementAlter.php index 13a8c58b..fddd816b 100644 --- a/src/Element/ComponentElementAlter.php +++ b/src/Element/ComponentElementAlter.php @@ -84,7 +84,7 @@ class ComponentElementAlter implements TrustedCallbackInterface { // merging with it. $element["#props"]["attributes"] = NestedArray::mergeDeep( $element["#attributes"], - $element["#props"]["attributes"] + $element["#props"]["attributes"] ?? [] ); return $element; } diff --git a/src/Template/TwigExtension.php b/src/Template/TwigExtension.php index d18a2ed6..b9cdf10a 100644 --- a/src/Template/TwigExtension.php +++ b/src/Template/TwigExtension.php @@ -145,6 +145,7 @@ class TwigExtension extends AbstractExtension { // an Attribute PHP object before running the validator. // Attribute PHP object are casted as string by the validator and trigger // '[attributes] String value found, but an object is required' error. + $context['attributes'] = $context['attributes'] ?? []; $context['attributes']['data-component-id'] = $component->getPluginId(); } -- GitLab