DNADesign\GridFieldBulkDelete\GridFieldBulkDeleteForm
Adds a dropdown and a button Allowing users to delete records in the GridField in bulk with the option to delete only records older than 1,2,3 or 6 months.
Also, if available, a queued job will be used if too many record need to be deleted.
Both this task and QueuedJob loop through the record and invoke "delete"
so any dependant record may be deleted as well.
Synopsis
class GridFieldBulkDeleteForm
implements
GridField_HTMLProvider,GridField_ActionProvider
{
- // members
- protected $targetFragment;
- protected $message;
- protected string $status = 'good';
- protected integer $use_queued_threshold = 50;
- // methods
- public void __construct()
- public void getHTMLFragments()
- public void getActions()
- public void handleAction()
- public void handleBulkDelete()
- public void getFilteredRecordList()
Hierarchy
Implements
- SilverStripe\Forms\GridField\GridField_HTMLProvider
- SilverStripe\Forms\GridField\GridField_ActionProvider
Members
protected
- $message
- $status
- $targetFragment
- $use_queued_threshold
Methods
public
- __construct()
- getActions() — export is an action button
- getFilteredRecordList() — To get the entire list of records with the potential filters we need to remove the pagination but apply all other filters
- getHTMLFragments()
- handleAction()
- handleBulkDelete() — Handle the export, for both the action button and the URL