Browse Source

feat: Add possibility to customize box class in admin groups

Quentin Somazzi 10 years ago
parent
commit
d1918aea51

+ 1 - 0
Mapper/BaseGroupedMapper.php

@@ -65,6 +65,7 @@ abstract class BaseGroupedMapper extends BaseMapper
             'description'        => false,
             'translation_domain' => null,
             'name'               => $name,
+            'box_class'          => 'box box-primary',
         );
 
         $code = $name;

BIN
Resources/doc/images/box_class.png


+ 9 - 0
Resources/doc/reference/action_create_edit.rst

@@ -30,6 +30,7 @@ When adding a form group to your edit/create form, you may specify some options
 - ``collapsed``: unused at the moment
 - ``class``: the class for your form group in the admin; by default, the value is set to ``col-md-12``.
 - ``fields``: the fields in your form group (you should NOT override this unless you know what you're doing).
+- ``box_class``: the class for your form group box in the admin; by default, the value is set to ``box box-primary``.
 - ``description``: to complete
 - ``translation_domain``: to complete
 
@@ -50,6 +51,7 @@ To specify options, do as follow:
                     ->with('Addresses',
                         array(
                             'class'       => 'col-md-8',
+                            'box_class'   => 'box box-solid box-danger',
                             'description' => 'Lorem ipsum',
                             // ...
                             ))
@@ -59,6 +61,13 @@ To specify options, do as follow:
             ;
     }
 
+Here is an example of what you can do with customizing the box_class on a group
+
+.. figure:: ../images/box_class.png
+    :align: center
+       :alt: Dashboard
+           :width: 500
+
 Embedding other Admins
 ----------------------
 

+ 1 - 1
Resources/views/CRUD/base_edit_form_macro.html.twig

@@ -21,7 +21,7 @@
         {% endif %}
 
             <div class="{{ group_class }}">
-                <div class="box box-primary">
+                <div class="{{ form_group.box_class }}">
                     <div class="box-header">
                         <h4 class="box-title">
                             {{ admin.trans(form_group.name, {}, form_group.translation_domain) }}