I\'m trying to put html inside a form button with twig like:
{{ form_widget(form.jiraStatus, {
\'label\': \'Bug\',
On Symfony 5.1, you can add html content into button label like this:
{{ form_widget(form.submit, { 'label': ' Calculate prices', 'label_html' : true })}}
You need to pass the option "label_html" : true
You can view the original Symfony/Twig code from form_div_layout.html.twig file to understand it:
{%- block button_widget -%}
{%- if label is empty -%}
{%- if label_format is not empty -%}
{% set label = label_format|replace({
'%name%': name,
'%id%': id,
}) %}
{%- elseif label is not same as(false) -%}
{% set label = name|humanize %}
{%- endif -%}
{%- endif -%}
{%- endblock button_widget -%}