Signify\Forms\GridField\GridFieldDeleteRelationsButton
Adds an delete button to the bottom or top of a GridField.
Clicking the button opens a modal in which a user can select filter options.
The user can then delete models from the gridfield's list based on those filter options.
Synopsis
class GridFieldDeleteRelationsButton
implements
GridField_HTMLProvider,GridField_URLHandler
{
- // constants
- const DEFAULT_OPTION = '__default';
- const OPTION_FIELD_SUFFIX = '__FilterOption';
- const FILTER_BY_SUFFIX = '__FilterBy';
- const FILTER_INVERT_SUFFIX = '__FilterInvert';
- const DELETE_ALL = 'DeleteAll__FilterAll';
- const STRING_FILTER_OPTIONS = ;
- const NUMBER_DATE_FILTER_OPTIONS = ;
- // members
- protected $targetFragment;
- protected GridField $gridField;
- protected DataObject $dummyObject;
- protected $modalTitle = NULL;
- protected FieldList $filterFields;
- protected array $filterOptions = ;
- // methods
- public void __construct()
- public array getHTMLFragments()
- public array getURLHandlers()
- public Form|false DeletionForm()
- public bool|HTTPResponse handleDelete()
- public FieldList getFilterFields()
- public $this setFilterFields()
- public array getFilterOptions()
- public $this setFilterOptions()
- public string getModalTitle()
- public $this setModalTitle()
- protected FieldList getPreparedFilterFields()
- protected CompositeField getFieldAsComposite()
- protected FormField getFilterTypesField()
- protected DataObject getDummyObject()
- protected array parseQueryString()
Hierarchy
Uses
- SilverStripe\Core\Injector\Injectable
- SilverStripe\Core\Extensible
Implements
- SilverStripe\Forms\GridField\GridField_HTMLProvider
- SilverStripe\Forms\GridField\GridField_URLHandler
Constants
Name | Value |
---|---|
DEFAULT_OPTION | '__default' |
OPTION_FIELD_SUFFIX | '__FilterOption' |
FILTER_BY_SUFFIX | '__FilterBy' |
FILTER_INVERT_SUFFIX | '__FilterInvert' |
DELETE_ALL | 'DeleteAll__FilterAll' |
STRING_FILTER_OPTIONS | |
NUMBER_DATE_FILTER_OPTIONS |
Members
protected
- $dummyObject
—
SilverStripe\ORM\DataObject
A singleton of the class held by the gridfield - $filterFields — SilverStripe\Forms\FieldList
- $filterOptions — array
- $gridField — SilverStripe\Forms\GridField\GridField
- $modalTitle — string
-
$targetFragment
Fragment to write the button to
Methods
protected
- getDummyObject() — Returns a singleton of the class held by the gridfield.
- getFieldAsComposite() — Get a CompositeField for the given field which contains all necessary filter fields to support the given field.
- getFilterTypesField() — Get a DropdownField with filter types as defined in {@link GridFieldDeleteRelationsButton::setFilterOptions()}.
- getPreparedFilterFields() — Get all composite fields for the modal form.
- parseQueryString() — An alternative to {@link parse_str()} which keeps periods intact.
public
- __construct()
- DeletionForm() — Generate a modal form for a single {@link DataObject} subclass.
- getFilterFields() — Get the fields to display in the filter modal.
- getFilterOptions() — Get the options by which each field can be filtered.
- getHTMLFragments() — Place the export button in a <p> tag below the field
- getModalTitle() — Get the title of the filter modal.
- getURLHandlers() — Map URL paths to action methods.
- handleDelete() — Deletes models from the gridfield list based on user-supplied filters.
- setFilterFields() — Set the fields to display in the filter modal.
- setFilterOptions() — Get the options by which each field can be filtered.
- setModalTitle() — Set the title of the filter modal.