Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
<feature> Add docs to explain how to customize form_theme layout. Issue
- Loading branch information
Showing
2 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
## form-theme | ||
|
||
This bundle provide a form-theme under [Resources/views/layout/form-theme.html.twig](Resources/views/layout/form-theme.html.twig) which | ||
allow customize the form elements in AdminTLE. | ||
|
||
This is used as: | ||
|
||
```twig | ||
{% form_theme form 'AvanzuAdminThemeBundle:layout:form-theme.html.twig' %} | ||
``` | ||
|
||
For override the default theme in twig template you need put in the template which you want the new form theme | ||
|
||
```twig | ||
{% form_theme form 'your-custom-form-theme-layout.html.twig' %} | ||
``` | ||
|
||
For example: | ||
|
||
```twig | ||
{% form_theme form 'bootstrap_3_layout.html.twig' %} | ||
``` | ||
|
||
You also could apply this, only checking if a form is defined: | ||
|
||
```twig | ||
{% if form is defined %} | ||
{% form_theme form 'AvanzuAdminThemeBundle:layout:form-theme.html.twig' %} | ||
{% endif %} | ||
``` | ||
|
||
Also is possible override the form theme by referencing | ||
[multiple templates](http://symfony.com/doc/current/cookbook/form/form_customization.html#multiple-templates) in order of priority or | ||
only customize/override some childs elements in the form like: | ||
|
||
```twig | ||
{% form_theme form.submit 'AvanzuAdminThemeBundle:layout:form-theme.html.twig' %} | ||
``` |