PHP Class GridFieldAddNewMultiClass, silverstripe-gridfieldextensions

By default the list of classes that are createable is the grid field's model class, and any subclasses. This can be customised using {@link setClasses()}.
Inheritance: implements GridField_HTMLProvider, implements GridField_URLHandler
Show file Open project: ajshort/silverstripe-gridfieldextensions Class Usage Examples

Protected Properties

Property Type Description
$itemRequestClass string

Public Methods

Method Description
__construct ( string $fragment = 'before' )
getClasses ( GridField $grid ) : array Gets the classes that can be created using this button, defaulting to the model class and its subclasses.
getFragment ( ) : string Gets the fragment name this button is rendered into.
getHTMLFragments ( $grid ) {@inheritDoc}
getTitle ( ) : string Gets the button title text.
getURLHandlers ( $grid ) {@inheritDoc}
handleAdd ( GridField $grid, SS_HTTPRequest $request ) : GridFieldAddNewMultiClassHandler Handles adding a new instance of a selected class.
setClasses ( array $classes, $default = null ) : GridFieldAddNewMultiClass Sets the classes that can be created using this button.
setDefaultClass ( string $default ) : GridFieldAddNewMultiClass Sets the default class that is selected automatically.
setFragment ( string $fragment ) : GridFieldAddNewMultiClass Sets the fragment name this button is rendered into.
setItemRequestClass ( $class )
setTitle ( string $title ) : GridFieldAddNewMultiClass Sets the button title text.

Method Details

__construct() public method

public __construct ( string $fragment = 'before' )
$fragment string the fragment to render the button in

getClasses() public method

Gets the classes that can be created using this button, defaulting to the model class and its subclasses.
public getClasses ( GridField $grid ) : array
$grid GridField
return array a map of class name to title

getFragment() public method

Gets the fragment name this button is rendered into.
public getFragment ( ) : string
return string

getHTMLFragments() public method

{@inheritDoc}
public getHTMLFragments ( $grid )

getTitle() public method

Gets the button title text.
public getTitle ( ) : string
return string

getURLHandlers() public method

{@inheritDoc}
public getURLHandlers ( $grid )

handleAdd() public method

Handles adding a new instance of a selected class.
public handleAdd ( GridField $grid, SS_HTTPRequest $request ) : GridFieldAddNewMultiClassHandler
$grid GridField
$request SS_HTTPRequest
return GridFieldAddNewMultiClassHandler

setClasses() public method

Sets the classes that can be created using this button.
public setClasses ( array $classes, $default = null ) : GridFieldAddNewMultiClass
$classes array a set of class names, optionally mapped to titles
return GridFieldAddNewMultiClass $this

setDefaultClass() public method

Sets the default class that is selected automatically.
public setDefaultClass ( string $default ) : GridFieldAddNewMultiClass
$default string the class name to use as default
return GridFieldAddNewMultiClass $this

setFragment() public method

Sets the fragment name this button is rendered into.
public setFragment ( string $fragment ) : GridFieldAddNewMultiClass
$fragment string
return GridFieldAddNewMultiClass $this

setItemRequestClass() public method

public setItemRequestClass ( $class )

setTitle() public method

Sets the button title text.
public setTitle ( string $title ) : GridFieldAddNewMultiClass
$title string
return GridFieldAddNewMultiClass $this

Property Details

$itemRequestClass protected property

protected string $itemRequestClass
return string