-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Block prefix ambiguity #6646
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
Closed
Closed
Block prefix ambiguity #6646
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
3cedd68
[book] [form] Ambiguous block prefixes render incorrectly
jonny-no1 f345358
Amend wording might not -> won't
jonny-no1 acac19f
Ambiguity applies to any registered field type
jonny-no1 0cb0a4f
Fix Sphinx link
jonny-no1 f5f0cd4
Revert incorrect merge conflict resolution
jonny-no1 0ee766b
Tweak wording
jonny-no1 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
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 |
---|---|---|
|
@@ -241,7 +241,7 @@ your controller:: | |
'form' => $form->createView(), | ||
)); | ||
} | ||
|
||
.. caution:: | ||
|
||
Be aware that the ``createView()`` method should be called *after* ``handleRequest`` | ||
|
@@ -686,7 +686,7 @@ the documentation for each type. | |
is left blank. If you don't want this behavior, either | ||
:ref:`disable HTML5 validation <book-forms-html5-validation-disable>` | ||
or set the ``required`` option on your field to ``false``:: | ||
|
||
->add('dueDate', 'date', array( | ||
'widget' => 'single_text', | ||
'required' => false | ||
|
@@ -1128,6 +1128,24 @@ the choice is ultimately up to you. | |
)); | ||
} | ||
|
||
.. caution:: | ||
|
||
When the name of your form class matches any registered field type that has | ||
its own theme fragment, your form won't be rendered correctly. A form | ||
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. A form type named [...] |
||
``AppBundle\\Form\\Type\\PasswordType`` to change a user password for | ||
instance will be mistaken for the built-in ``PasswordType`` field type and | ||
will be rendered incorrectly using the ``password_widget`` theme fragment. | ||
You can still use the class name of your choice by overriding the | ||
``getBlockPrefix`` method of your form class:: | ||
|
||
public function getBlockPrefix() | ||
{ | ||
return 'app_bundle_password'; | ||
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. Why not just |
||
} | ||
|
||
Read the ":doc:`/cookbook/form/create_custom_field_type`" chapter for more | ||
information. | ||
|
||
.. tip:: | ||
|
||
When mapping forms to objects, all fields are mapped. Any fields on the | ||
|
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.
[...] form type class [...]