Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork5.3k
Rename CollectionType entry options#5051
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Closed
Uh oh!
There was an error while loading.Please reload this page.
Closed
Changes fromall commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
4 changes: 2 additions & 2 deletionscookbook/form/form_collections.rst
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
55 changes: 32 additions & 23 deletionsreference/forms/types/collection.rst
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 |
|---|---|---|
| @@ -16,10 +16,10 @@ forms, which is useful when creating forms that expose one-to-many relationships | ||
| | Options | - `allow_add`_ | | ||
| | | - `allow_delete`_ | | ||
| | | - `delete_empty`_ | | ||
| | | - `entry_options`_ | | ||
| | | - `entry_type`_ | | ||
| | | - `prototype`_ | | ||
| | | - `prototype_name`_ | | ||
Member 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. You have to change the option name in line 14 too. | ||
| +-------------+-----------------------------------------------------------------------------+ | ||
| | Inherited | - `by_reference`_ | | ||
| | options | - `cascade_validation`_ | | ||
| @@ -52,10 +52,10 @@ to an array of email addresses. In the form, you want to expose each email | ||
| address as its own input text box:: | ||
| $builder->add('emails', 'collection', array( | ||
| // eachentry in the array will be an "email" field | ||
| 'entry_type' => 'email', | ||
| // these options are passed to each "email" type | ||
| 'entry_options' => array( | ||
| 'required' => false, | ||
| 'attr' => array('class' => 'email-box') | ||
| ), | ||
| @@ -266,19 +266,24 @@ form you have to set this option to true. However, existing collection entries | ||
| will only be deleted if you have the allow_delete_ option enabled. Otherwise | ||
| the empty values will be kept. | ||
| entry_options | ||
| ~~~~~~~~~~~~~ | ||
| .. versionadded:: 2.7 | ||
| The ``entry_options`` option was introduced in Symfony 2.7 in favor of | ||
| ``options``, which is available prior to 2.7. | ||
| **type**: ``array`` **default**: ``array()`` | ||
| This is the array that's passed to the form type specified in the `entry_type`_ | ||
| option. For example, if you used the :doc:`choice </reference/forms/types/choice>` | ||
| type as your `entry_type`_ option (e.g. for a collection of drop-down menus), | ||
| then you'd need to at least pass the ``choices`` option to the underlying | ||
| type:: | ||
| $builder->add('favorite_cities', 'collection', array( | ||
| 'entry_type' => 'choice', | ||
| 'entry_options' => array( | ||
| 'choices' => array( | ||
| 'nashville' => 'Nashville', | ||
| 'paris' => 'Paris', | ||
| @@ -288,6 +293,21 @@ you'd need to at least pass the ``choices`` option to the underlying type:: | ||
| ), | ||
| )); | ||
| entry_type | ||
| ~~~~~~~~~~ | ||
| .. versionadded:: 2.7 | ||
| The ``entry_type`` option was introduced in Symfony 2.7 in favor of | ||
| ``type``, which is available prior to 2.7. | ||
| **type**: ``string`` or :class:`Symfony\\Component\\Form\\FormTypeInterface` **required** | ||
| This is the field type for each entry in this collection (e.g. ``text``, ``choice``, | ||
| etc). For example, if you have an array of email addresses, you'd use the | ||
| :doc:`email </reference/forms/types/email>` type. If you want to embed | ||
| a collection of some other form, create a new instance of your form type | ||
| and pass it as this option. | ||
| prototype | ||
| ~~~~~~~~~ | ||
| @@ -336,17 +356,6 @@ If you have several collections in your form, or worse, nested collections | ||
| you may want to change the placeholder so that unrelated placeholders are not | ||
| replaced with the same value. | ||
| Inherited Options | ||
| ----------------- | ||
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.