\Dewdrop\Fields\Listing\BulkActionsActionInterface

This is the interface you should implement to add an action to a BulkActions object for your listing.

Summary

Methods
Constants
shouldProcess()
process()
render()
No constants found
No protected methods found
N/A
No private methods found
N/A

Methods

shouldProcess()

shouldProcess() : boolean

Determine whether your action should be processed. Typically, you should be adding some kind of input (perhaps a submit button with a known ID or a hidden input that you set via some custom JavaScript) to the request that you can use to detect when the user has chosen to run your particular bulk action.

Returns

boolean

process()

process(array  $selected) : mixed

Process the provided array of selected IDs. The IDs will always be legit values from the Listing's primary key field. This means that the ID was presented to the user and they were allowed to select it. Your process method will also only be called when there is at least 1 selected value, so you don't have to worry about empty array if you're using an IN operator.

Parameters

array $selected

Returns

mixed

render()

render(\Dewdrop\View\View  $view) : mixed

Render some controls for your action. Could be as simple as a single submit button or something more complex/dynamic using a view script partial, custom CSS and JS, etc.

Parameters

\Dewdrop\View\View $view

Returns

mixed