Skip to content

Commit

Permalink
Merge pull request sonata-project#1432 from tiagojsag/collection_type…
Browse files Browse the repository at this point in the history
…_docs

documentation update on sonata_type_collection
  • Loading branch information
rande committed Jun 25, 2013
2 parents a37dd71 + 9e3dee7 commit fdc0542
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions Resources/doc/reference/form_types.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,29 @@ sonata_type_collection

The ``Collection Type`` is meant to handle creation and edition of model
collections. Rows can be added and deleted, and your model abstraction layer may
allow you to edit fields inline.
allow you to edit fields inline. You can use ``type_options`` to pass values
to the underlying forms.

**TIP**: A jQuery event is fired after a row has been added(*sonata-collection-item-added*) or deleted(*sonata-collection-item-deleted*). You can bind to them to trigger some custom javascript imported into your templates(eg: add a calendar widget to a just added date field)

Type configuration
^^^^^^^^^^^^^^^^^^
.. code-block:: php
todo
class AcmeProductAdmin extends Admin
{
protected function configureFormFields(FormMapper $formMapper)
{
$formMapper
->add('sales', 'sonata_type_collection', array(
//Prevents the "Delete" option from being displayed
'type_options' => array('delete' => false)
), array(
'edit' => 'inline',
'inline' => 'table',
'sortable' => 'position',
))
;
}
}
**TIP**: A jQuery event is fired after a row has been added(*sonata-collection-item-added*) or deleted(*sonata-collection-item-deleted*). You can bind to them to trigger some custom javascript imported into your templates(eg: add a calendar widget to a just added date field)

Field configuration
^^^^^^^^^^^^^^^^^^^
Expand Down

0 comments on commit fdc0542

Please sign in to comment.