class BulkManager implements GridField_HTMLProvider, GridField_ColumnProvider, GridField_URLHandler (View source)

GridField component for editing attached models in bulk.

Traits

A class that can be instantiated or replaced via DI

Properties

protected array $config

component configuration.

Methods

public static 
create(mixed ...$args)

An implementation of the factory method, allows you to create an instance of a class

public static 
singleton(string $class = null)

Creates a class instance by the "singleton" design pattern.

public
__construct(array $editableFields = null, bool $defaultActions = true, $defaultVersionedActions = false)

BulkManager component constructor.

public
setConfig(string $reference, mixed $value)

Sets the component configuration parameter.

public
mixed
getConfig(string $reference = false)

Returns one $config parameter of the full $config.

public
$this
addBulkAction(string $handlerClassName, string $action = null)

Lets you add custom bulk actions to the bulk manager interface.

public
$this
removeBulkAction(string $handlerClassName = null, string $urlSegment = null)

Removes a bulk actions from the bulk manager interface.

public
getBulkActions()

Return the list of bulk actions already provided

public
augmentColumns(GridField $gridField, array $columns)

Add bulk select column.

public
array
getColumnsHandled(GridField $gridField)

Which columns are handled by the component.

public
string
getColumnContent(GridField $gridField, ViewableData $record, string $columnName)

Sets the column's content.

public
array
getColumnAttributes(GridField $gridField, ViewableData $record, string $columnName)

Set the column's HTML attributes.

public
array
getColumnMetadata(GridField $gridField, string $columnName)

Set the column's meta data.

public
array
getHTMLFragments(GridField $gridField)

No description

public
array
getURLHandlers(GridField $gridField)

Returns an action => handler list.

public
mixed
handleBulkAction(GridField $gridField, HTTPRequest $request)

Pass control over to the RequestHandler loop through the handlers provided in config['actions'] and find matching url_handlers.

Details

static Injectable create(mixed ...$args)

An implementation of the factory method, allows you to create an instance of a class

This method will defer class substitution to the Injector API, which can be customised via the Config API to declare substitution classes.

This can be called in one of two ways - either calling via the class directly, or calling on Object and passing the class name as the first parameter. The following are equivalent: $list = DataList::create(SiteTree::class); $list = SiteTree::get();

Parameters

mixed ...$args

Return Value

Injectable

static Injectable singleton(string $class = null)

Creates a class instance by the "singleton" design pattern.

It will always return the same instance for this class, which can be used for performance reasons and as a simple way to access instance methods which don't rely on instance data (e.g. the custom SilverStripe static handling).

Parameters

string $class

Optional classname to create, if the called class should not be used

Return Value

Injectable

The singleton instance

__construct(array $editableFields = null, bool $defaultActions = true, $defaultVersionedActions = false)

BulkManager component constructor.

Parameters

array $editableFields

List of editable fields

bool $defaultActions

Use default actions list. False to start fresh.

$defaultVersionedActions

setConfig(string $reference, mixed $value)

Sets the component configuration parameter.

Parameters

string $reference
mixed $value

mixed getConfig(string $reference = false)

Returns one $config parameter of the full $config.

Parameters

string $reference

$congif parameter to return

Return Value

mixed

$this addBulkAction(string $handlerClassName, string $action = null)

Lets you add custom bulk actions to the bulk manager interface.

Exisiting handler will be replaced

Parameters

string $handlerClassName

RequestHandler class name for this action.

string $action

Specific RequestHandler action to be called.

Return Value

$this

Current BulkManager instance

$this removeBulkAction(string $handlerClassName = null, string $urlSegment = null)

Removes a bulk actions from the bulk manager interface.

Parameters

string $handlerClassName

RequestHandler class name of the action to remove.

string $urlSegment

URL segment of the action to remove.

Return Value

$this

Current BulkManager instance

RequestHandler[] getBulkActions()

Return the list of bulk actions already provided

Return Value

RequestHandler[]

augmentColumns(GridField $gridField, array $columns)

Add bulk select column.

Parameters

GridField $gridField
array $columns

List reference of all column names.

array getColumnsHandled(GridField $gridField)

Which columns are handled by the component.

Parameters

GridField $gridField

Return Value

array

string getColumnContent(GridField $gridField, ViewableData $record, string $columnName)

Sets the column's content.

Parameters

GridField $gridField
ViewableData $record
  • Record displayed in this row
string $columnName

Return Value

string
  • HTML for the column. Return NULL to skip.

array getColumnAttributes(GridField $gridField, ViewableData $record, string $columnName)

Set the column's HTML attributes.

Parameters

GridField $gridField
ViewableData $record

displayed in this row

string $columnName

Return Value

array

array getColumnMetadata(GridField $gridField, string $columnName)

Set the column's meta data.

Parameters

GridField $gridField
string $columnName

Return Value

array
  • Map of arbitrary metadata identifiers to their values.

array getHTMLFragments(GridField $gridField)

No description

Parameters

GridField $gridField

Return Value

array

array getURLHandlers(GridField $gridField)

Returns an action => handler list.

Parameters

GridField $gridField

Return Value

array

mixed handleBulkAction(GridField $gridField, HTTPRequest $request)

Pass control over to the RequestHandler loop through the handlers provided in config['actions'] and find matching url_handlers.

$url_handlers rule should not use wildcards like '$Action' => '$Action' but have more specific path defined

Parameters

GridField $gridField
HTTPRequest $request

Return Value

mixed