G
G
Grigory Vasilkov2017-05-27 17:26:43
PHP
Grigory Vasilkov, 2017-05-27 17:26:43

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)?
46ce779f35d94eb59f574253aa8f0d95.jpg
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 question

Ask a Question

731 491 924 answers to any question