Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions templates/forms/fields/checkbox/checkbox.html.twig
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
{% extends "forms/field.html.twig" %}

{% block label %}
{% set id = field.id|default(field.name) ~ '-' ~ key %}
<label style="display:inline;" class="inline" for="{{ id|e }}">
{% if field.markdown %}
{{ field.label|t|markdown(false) }}
{% else %}
{{ field.label|t|e }}
{% endif %}
{{ field.validate.required in ['on', 'true', 1] ? '<span class="required">*</span>' }}
</label>
{% endblock %}

{% block input %}
{% set id = field.id|default(field.name) ~ '-' ~ key %}
<div class="{{ form_field_wrapper_classes ?: 'form-input-wrapper' }} {{ field.size }} {{ field.wrapper_classes }}">
<input
{# required attribute structures #}
Expand All @@ -24,13 +32,5 @@
{% if required %}required="required"{% endif %}
{% endblock %}
/>
<label style="display:inline;" class="inline" for="{{ id|e }}">
{% if field.markdown %}
{{ field.label|t|markdown(false) }}
{% else %}
{{ field.label|t|e }}
{% endif %}
{{ field.validate.required in ['on', 'true', 1] ? '<span class="required">*</span>' }}
</label>
</div>
{% endblock %}
12 changes: 12 additions & 0 deletions templates/forms/fields/textarea/textarea.html.twig
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
{% extends "forms/field.html.twig" %}

{% block label %}
{% endblock %}

{% block input %}
{% set id = field.id|default(field.name) ~ '-' ~ key %}
<div class="{{ form_field_wrapper_classes ?: 'form-textarea-wrapper' }} {{ field.size }} {{ field.wrapper_classes }}">
<label style="display:inline;" class="inline" for="{{ id|e }}">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the purpose of putting the label in this input block and not the label block? This will change the display on all forms with textarea as the div/class structure is changed.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's right. I've rearranged the code now. Let me know if that looks better!

{% if field.markdown %}
{{ field.label|t|markdown(false) }}
{% else %}
{{ field.label|t|e }}
{% endif %}
{{ field.validate.required in ['on', 'true', 1] ? '<span class="required">*</span>' }}
</label>
<textarea
{# required attribute structures #}
name="{{ (scope ~ field.name)|fieldName }}"
Expand Down