We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3962582 commit 1fe2ae3Copy full SHA for 1fe2ae3
src/StimulusBundle/src/Dto/StimulusAttributes.php
@@ -15,6 +15,7 @@
15
16
use Twig\Environment;
17
use Twig\Extension\EscaperExtension;
18
+use Twig\Runtime\EscaperRuntime;
19
20
/**
21
* Helper to build Stimulus-related HTML attributes.
@@ -215,6 +216,10 @@ private function getFormattedValue(mixed $value): string
215
216
217
private function escapeAsHtmlAttr(mixed $value): string
218
{
219
+ if (class_exists(EscaperRuntime::class)) {
220
+ return $this->env->getRuntime(EscaperRuntime::class)->escape($value, 'html_attr');
221
+ }
222
+
223
if (method_exists(EscaperExtension::class, 'escape')) {
224
return EscaperExtension::escape($this->env, $value, 'html_attr');
225
}
0 commit comments