Readme update for bulk manager

This commit is contained in:
Thierry François 2018-02-12 15:32:28 +02:00
parent 5711998ef2
commit 1b450a5455
2 changed files with 6 additions and 13 deletions

View File

@ -16,7 +16,7 @@ Set of SilverStripe 4 GridField components to facilitate bulk file upload & reco
[More screenshots here.](screenshots) [More screenshots here.](screenshots)
## Requirements ## Requirements
* SilverStripe 4.0 (version master / 3.+) * SilverStripe 4.0 (3.+)
* SilverStripe 3.1 (version 2.+ / 1.+) * SilverStripe 3.1 (version 2.+ / 1.+)
* Silverstripe 3.0 (version [0.5](https://github.com/colymba/GridFieldBulkEditingTools/tree/0.5)) * Silverstripe 3.0 (version [0.5](https://github.com/colymba/GridFieldBulkEditingTools/tree/0.5))
@ -44,7 +44,7 @@ Upload multiple images or files at once into DataObjects. Perfect for galleries
$config->addComponent(new \Colymba\BulkUpload\BulkUploader()); $config->addComponent(new \Colymba\BulkUpload\BulkUploader());
``` ```
See [BULK_UPLOAD.md](bulkUpload/BULK_UPLOAD.md) for detailed configuration. See [BULK_UPLOAD.md](docs/en/BULK_UPLOAD.md) for detailed configuration.
## Bulk Manager ## Bulk Manager
Perform actions on multiple records straight from the GridField Perform actions on multiple records straight from the GridField
@ -53,7 +53,7 @@ Perform actions on multiple records straight from the GridField
$config->addComponent(new \Colymba\BulkManager\BulkManager()); $config->addComponent(new \Colymba\BulkManager\BulkManager());
``` ```
See [BULK_MANAGER.md](bulkManager/BULK_MANAGER.md) for detailed configuration. See [BULK_MANAGER.md](docs/en//BULK_MANAGER.md) for detailed configuration.
## Interdependencies ## Interdependencies
The `BulkUploader` component makes use of `BulkManager` to allow quick editing of the newly uploaded files. Although not nescessary for the component to work, adding `Colymba\BulkManager\BulkManager` too to your `GridFieldConfig` will give you this advantage. The `BulkUploader` component makes use of `BulkManager` to allow quick editing of the newly uploaded files. Although not nescessary for the component to work, adding `Colymba\BulkManager\BulkManager` too to your `GridFieldConfig` will give you this advantage.

View File

@ -28,20 +28,13 @@ To add a custom bulk action to the list use:
```php ```php
$config $config
->getComponentByType('Colymba\\BulkManager\\BulkManager') ->getComponentByType('Colymba\\BulkManager\\BulkManager')
->addBulkAction('actionName', 'Dropdown label', 'ActionHandlerClassName', $frontEndConfig) ->addBulkAction('Namespace\\ClassName')
``` ```
You can omit the handler's class name and the front-end config array, those will default to:
* `'GridFieldBulkAction'.ucfirst($name).'Handler'`
* `$config = array( 'isAjax' => true, 'icon' => 'accept', 'isDestructive' => false )`
#### Custom action handler #### Custom action handler
When creating your own bulk action `RequestHandler`, you should extend `Colymba\BulkManager\BulkAction\Handler` which will expose 2 useful functions `getRecordIDList()` and `getRecords()` returning either an array with the selected records IDs or a `DataList` of the selected records. When creating your own bulk action `RequestHandler`, you should extend `Colymba\BulkManager\BulkAction\Handler` which will expose 2 useful functions `getRecordIDList()` and `getRecords()` returning either an array with the selected records IDs or a `DataList` of the selected records.
Make sure to define your `$allowed_actions` and `$url_handlers` on your custom bulk action handler. See `Handler`, `DeleteHandler` and `UnlinkHandler` for examples. Make sure to define the handler's `$url_segment`, from which the handler will be called and its relating `$allowed_actions` and `$url_handlers`. See `Handler`, `DeleteHandler` and `UnlinkHandler` for examples.
#### Front-end config #### Front-end config
The last `addBulkAction()` parameter lets you pass an array with configuration options for the UI/UX: Bulk action handler's front-end configuration is set via class properties `label`, `icon`, `buttonClasses`, `xhr` and `destructive`. See `Handler`, `DeleteHandler` and `UnlinkHandler` for reference and examples.
* `isAjax`: if true the action will be called via XHR request otherwise the browser will be redirected to the action's URL
* `icon`: lets you define which icon to use on the button when the action is selected (SilverStripe button icon name only)
* `isDestructive`: if true, a confirmation dialog will be shown before the action is processed