Answer the question
In order to leave comments, you need to log in
How to make the correct output of html tag attributes in twig (second quotes are added)?
How to make the correct output of html tag attributes in twig (second quotes are added)?
The code is like this:
// controller.php
$scripts[] = [
...
'integrity' => ($integrity) ? sprintf(' integrity="%s"', $integrity) : null,
],
// view.twig
{% for script in scripts %}
<script type="text/javascript" id="{{ script.code }}-js" src="{{ script.src }}"{{ script.integrity|raw }} crossorigin="anonymous"></script>
{% endfor %}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question