Skip to content

Commit

Permalink
<feature> Add docs to explain how to customize form_theme layout. Issue
Browse files Browse the repository at this point in the history
  • Loading branch information
shakaran committed Oct 22, 2017
1 parent cbab11c commit 45b7197
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -159,6 +159,7 @@ If the assetic bundle is installed but you don't want the AdminThemeBundle to us
* [Sidebar User](Resources/docs/sidebar_user.md)
* [Sidebar Navigation](Resources/docs/sidebar_navigation.md)
* [Breadcrumb Menu](Resources/docs/breadcrumbs.md)
* [Form theme](Resources/docs/form_theme.md)

[1]: https://almsaeedstudio.com/themes/AdminLTE/documentation/index.html
[2]: https://img.shields.io/badge/Symfony-%202.x%20&%203.x-green.svg
Expand Down
38 changes: 38 additions & 0 deletions Resources/docs/form_theme.md
@@ -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' %}
```

0 comments on commit 45b7197

Please sign in to comment.