Skip to content

Commit

Permalink
feature #2193 Make form groups collapsible (alterphp)
Browse files Browse the repository at this point in the history
This PR was submitted for the master branch but it was squashed and merged into the 1.x branch instead (closes #2193).

Discussion
----------

Make form groups collapsible

I send it to master, but ... it basically can go the 1.x branch as well.

Commits
-------

6ee3612 Make form groups collapsible
  • Loading branch information
javiereguiluz committed Apr 17, 2018
2 parents 2cce56f + 6ee3612 commit af564be
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
11 changes: 11 additions & 0 deletions doc/book/edit-new-configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -751,6 +751,17 @@ very advanced layouts.
This solves most of the issues, but sometimes you might be forced to also
reorder the form group positions.

.. tip::

Taking advantage of Bootstrap capabilities, you can make form groups **collapsible**:

.. code-block:: yaml
# ...
- { type: 'group', collapsible: true, expanded: false }
An icon button in the title bar toggles the content. **expanded** option defines the state at load (default: *true*).

Form Tabs
.........

Expand Down
7 changes: 6 additions & 1 deletion src/Resources/views/form/bootstrap_3_layout.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -545,10 +545,15 @@
{% endif %}
{{ group_config.label|trans(domain = _translation_domain)|raw }}
</h3>
{% if group_config.collapsible|default(false) %}
<a class="pull-right" role="button" data-toggle="collapse" href="#box-body-{{ group_name }}">
<i class="fa fa-expand"></i>
</a>
{% endif %}
</div>
{% endif %}

<div class="box-body">
<div class="box-body{% if group_config.collapsible|default(false) %} collapse{% if group_config.expanded|default(false) %} in{% endif %}{% endif %}" id="box-body-{{ group_name }}">
{% if group_config.help|default(false) %}
<p class="help-block">{{ group_config.help|trans(domain = _translation_domain)|nl2br|raw }}</p>
{% endif %}
Expand Down

0 comments on commit af564be

Please sign in to comment.