An "optional" string rendering is introduced by mopa / bootstrap-bundle .
It can be found in the package Resources / Views / Form / fields.html.twig .
An “optional” line is added to the form_label_asterisk block:
{% block label_asterisk %} {% if required %} {% if render_required_asterisk %} <span>*</span> {% endif %} {% else %} {% if render_optional_text %} <span>{{ "(optional)"|trans({}, translation_domain) }}</span> {% endif %} {% endif %} {% endblock label_asterisk %}
As you can see, rendering requires you to set domain_domain for the optional string to translate. The correct implementation would use return to messages
... <span>{{ "(optional)"|trans({}, translation_domain|default('messages')) }}</span> ...
Decision:
Remove the optional rendering completely by adding to your config.yml:
# app/config/config.yml parameters: mopa_bootstrap.form.render_optional_text: false
... or add render_optional_text => false to the form parameters.
As an initial form type, BootstrapBundle can be found here .
Alternatively, you can remove the optional line by overriding the block in one form
{% form_theme form _self %} {% block label_asterisk %} {% if required %} {% if render_required_asterisk %} <span>*</span> {% endif %} {% endif %} {% endblock label_asterisk %}
More details on form overrides can be found in my answer here .
source share