Browse Source

add * for required fields

Charley Maillot 13 năm trước cách đây
mục cha
commit
f2f6348d26

+ 0 - 6
Resources/public/css/layout.css

@@ -85,10 +85,4 @@ em.sonata-ba-field-help {
     display: block;
     color: #999;
     margin-bottom: 10px;
-}
-.required{
-    color:red;
-}
-.required:after{
-  content:"*";
 }

+ 2 - 2
Resources/views/Form/form_admin_fields.html.twig

@@ -20,9 +20,9 @@ file that was distributed with this source code.
         <div id="sonata-ba-field-container-{{ id }}">
             {% block label %}
                 {% if sonata_admin.field_description.options.name is defined %}
-                    {{ form_label(form, sonata_admin.field_description.options.name) }}
+                    {{ form_label(form, sonata_admin.field_description.options.name) }}{{ required ? '*' : '' }}
                 {% else %}
-                    {{ form_label(form) }}
+                    {{ form_label(form) }}{{ required ? '*' : '' }}
                 {% endif %}
                 <br />
             {% endblock %}