Quellcode durchsuchen

Merge pull request #822 from uwej711/form_label

Form label
Thomas vor 13 Jahren
Ursprung
Commit
27b0120ed1

+ 4 - 1
Resources/views/Form/form_admin_fields.html.twig

@@ -10,8 +10,11 @@ file that was distributed with this source code.
 #}
 
 {# Labels #}
-{% block generic_label %}
+{% block form_label %}
 {% spaceless %}
+    {% if not compound %}
+        {% set attr = attr|merge({'for': id}) %}
+    {% endif %}
     {% if required %}
         {% set attr = attr|merge({'class': attr.class|default('') ~ ' required'}) %}
     {% endif %}

+ 4 - 1
Resources/views/Form/silex_form_div_layout.html.twig

@@ -38,8 +38,11 @@
 
 {# Labels #}
 
-{% block generic_label %}
+{% block form_label %}
 {% spaceless %}
+    {% if not compound %}
+        {% set attr = attr|merge({'for': id}) %}
+    {% endif %}
     {% if required %}
         {% set attr = attr|merge({'class': attr.class|default('') ~ ' required'}) %}
     {% endif %}