-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Added a note about customizing a form with more than one template #3875
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
weaverryan
merged 6 commits into
symfony:2.3
from
javiereguiluz:improve_form_customization
Jul 11, 2014
Merged
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
2b0213b
Added a note about customizing a form with more than one template
javiereguiluz 6621720
Minor formatting improvement
javiereguiluz 94625c5
Fixed minor formatting issue
javiereguiluz 08d26ee
Removed the old syntax and left just the "with" keyword syntax
javiereguiluz 1b386ff
Fixed a minor error
javiereguiluz ce14104
Fixed a minor grammar mistake
javiereguiluz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next
Next commit
Added a note about customizing a form with more than one template
- Loading branch information
commit 2b0213b365f2f11e6c8db324f093280d5248512d
There are no files selected for viewing
This file contains hidden or 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 |
---|---|---|
|
@@ -298,6 +298,33 @@ When the ``form.age`` widget is rendered, Symfony will use the ``integer_widget` | |
block from the new template and the ``input`` tag will be wrapped in the | ||
``div`` element specified in the customized block. | ||
|
||
Multiple templates | ||
.................. | ||
|
||
A form can also be customized applying several templates. To do so, pass the | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
name of all the templates to the ``form_theme`` tag separat 7859 ing them with one | ||
whitespace: | ||
|
||
.. code-block:: html+jinja | ||
|
||
{% form_theme form '::common.html.twig' ':Form:fields.html.twig' | ||
'AcmeDemoBundle:Form:fields.html.twig' %} | ||
|
||
{# ... #} | ||
|
||
The templates can be located at different bundles and they can even be stored | ||
at the global ``app/Resources/views/`` directory. | ||
|
||
When using the ``with`` keyword, pass the templates as an array: | ||
|
||
|
||
.. code-block:: html+jinja | ||
|
||
{% form_theme form with ['::common.html.twig', ':Form:fields.html.twig', | ||
'AcmeDemoBundle:Form:fields.html.twig'] %} | ||
|
||
{# ... #} | ||
|
||
Child Forms | ||
........... | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Multiple Templates