Changeset 8318
- Timestamp:
- 04/05/08 17:12:58 (3 months ago)
- Files:
-
- doc/branches/1.1/book/14-Generators.txt (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
doc/branches/1.1/book/14-Generators.txt
r8289 r8318 845 845 _edit: ~ 846 846 _delete: ~ 847 batch_actions: 848 _delete: ~ 847 849 actions: 848 850 _create: ~ … … 856 858 _delete: ~ 857 859 858 In a `list` view, there are t wo action settings: the list of actions available for every object, and the list of actions available for the whole page. The list interactions defined in Listing 14-31 render like in Figure 14-22. Each line shows one button to edit the record and one to delete it. At the bottom of the list, a button allows the creation of a new record.860 In a `list` view, there are three action settings: the actions available for every object (`object_actions`), the actions available for a selection of objects (`batch_actions`), and actions available for the whole page (`actions`). The list interactions defined in Listing 14-31 render like in Figure 14-22. Each line shows one button to edit the record and one to delete it, plus one checkbox on each line to delete a selection of records. At the bottom of the list, a button allows the creation of a new record. 859 861 860 862 Figure 14-22 - Interactions in the `list` view … … 862 864  863 865 864 In an `edit` view, as there is only one record edited at a time, there is only one set of actions to define . The `edit` interactions defined in Listing 14-31 render like in Figure 14-23. Both the `save` and the `save_and_add` actions save the current edits in the records, the difference being that the `save` action displays the `edit` view on the current record after saving, while the `save_and_add` action displays an empty `edit` view to add another record. The `save_and_add` action is a shortcut that you will find very useful when adding many records in rapid succession. As for the position of the `delete` action, it is separated from the other buttons so that users don't click it by mistake.866 In an `edit` view, as there is only one record edited at a time, there is only one set of actions to define (under `actions`). The `edit` interactions defined in Listing 14-31 render like in Figure 14-23. Both the `save` and the `save_and_add` actions save the current edits in the records, the difference being that the `save` action displays the `edit` view on the current record after saving, while the `save_and_add` action displays an empty `edit` view to add another record. The `save_and_add` action is a shortcut that you will find very useful when adding many records in rapid succession. As for the position of the `delete` action, it is separated from the other buttons so that users don't click it by mistake. 865 867 866 868 The interaction names starting with an underscore (`_`) tell symfony to use the default icon and action corresponding to these interactions. The administration generator understands `_edit`, `_delete`, `_create`, `_list`, `_save`, `_save_and_add`, and `_create`. … … 870 872  871 873 872 But you can also add a custom interaction, in which case you must specify a name starting with no underscore, a s in Listing 14-32.874 But you can also add a custom interaction, in which case you must specify a name starting with no underscore, and a target action in the current module, as in Listing 14-32. 873 875 874 876 Listing 14-32 - Defining a Custom Interaction … … 900 902 $this->redirect('comment/edit?id='.$comment->getId()); 901 903 } 904 905 Batch actions receive an array of the primary keys of the selected records in the `sf_admin_batch_selection` request parameter. 902 906 903 907 One last word about actions: If you want to suppress completely the actions for one category, use an empty list, as in Listing 14-34.