diff --git a/docs/_partials/pages/index/bulk-actions.rst b/docs/_partials/pages/index/bulk-actions.rst new file mode 100644 index 00000000..f4d39dae --- /dev/null +++ b/docs/_partials/pages/index/bulk-actions.rst @@ -0,0 +1,27 @@ +Bulk Actions +------------ + +The Crud plugin provides bulk actions which can be easily used with crud view. + +To set up crud action in controller do something like this in initialize method. + +.. code-block:: php + + $this->loadComponent('Crud.Crud', [ + 'actions' => [ + 'deleteAll' => [ + 'className' => 'Crud.Bulk/Delete', + ], + ] + ]); + +Once a bulk action has been mapped, the ``scaffold.bulk_actions`` configuration +key can be specified. The ``scaffold.bulk_actions`` configuration key takes an +array of key/value pairs, where the key is the url and the value is the title. + +.. code-block:: php + + $action = $this->Crud->action(); + $action->config('scaffold.bulk_actions', [ + Router::url(['action' => 'deleteAll']) => __('Delete records'), + ]); diff --git a/docs/basic-usage.rst b/docs/basic-usage.rst index edb5f112..3f03f4cc 100644 --- a/docs/basic-usage.rst +++ b/docs/basic-usage.rst @@ -491,30 +491,7 @@ alter the ``contain()`` list for the pagination query: return $this->Crud->execute(); } -Bulk Actions ------------- - -The Crud plugin provides bulk actions which can be easily used with crud view. - -To set up crud action in controller do something like this in initialize method. - -.. code-block:: php - - $this->loadComponent('Crud.Crud', [ - 'actions' => [ - 'deleteAll' => [ - 'className' => 'Crud.Bulk/Delete', - ], - ] - ]); - -Then you need to configure scaffold to display select with actions. - -.. code-block:: php - - $action->config('scaffold.bulk_actions', [ - Router::url(['action' => 'deleteAll']) => __('Delete records'), - ]); +.. include:: /_partials/pages/index/bulk-actions.rst Going Forward ------------- diff --git a/docs/index-pages/customizing-the-index-page.rst b/docs/index-pages/customizing-the-index-page.rst index e6830848..bf8dd906 100644 --- a/docs/index-pages/customizing-the-index-page.rst +++ b/docs/index-pages/customizing-the-index-page.rst @@ -19,6 +19,7 @@ in scope. To limit the fields used, simply specify an array of fields: .. include:: /_partials/fields/formatter-element.rst .. include:: /_partials/pages/index/buttons.rst +.. include:: /_partials/pages/index/bulk-actions.rst .. include:: /_partials/pages/index/finder-scopes.rst .. include:: /_partials/pages/index/filters.rst .. include:: /_partials/pages/index/multiple-pages.rst