GridFieldAddClassesButton
class GridFieldAddClassesButton implements GridField_HTMLProvider, GridField_ActionProvider (View source)
A button which allows objects to be created with a specified classname(s)
Methods
No description
Change the button name
Get the button name
Gets the fragment name this button is rendered into.
Sets the fragment name this button is rendered into.
Get extra button class
Sets extra CSS classes for this button
Get the classes of the objects to create
Gets the list of classes which can be created, with checks for permissions.
Specify the classes to create
Returns a map where the keys are fragment names and the values are pieces of HTML to add to these fragments.
Handle an action on the given {@link GridField}.
Details
__construct(array $classes, string $targetFragment = 'buttons-before-left')
$this
setButtonName(string $name)
Change the button name
string
getButtonName()
Get the button name
string
getFragment()
Gets the fragment name this button is rendered into.
GridFieldAddNewInlineButton
setFragment(string $fragment)
Sets the fragment name this button is rendered into.
string
getButtonClass()
Get extra button class
$this
setButtonClass(string $buttonClass)
Sets extra CSS classes for this button
array
getClasses()
Get the classes of the objects to create
array
getClassesCreate(DataGrid $grid)
Gets the list of classes which can be created, with checks for permissions.
Will fallback to the default model class for the given DataGrid
setClasses(array $classes)
Specify the classes to create
array
getHTMLFragments($grid)
Returns a map where the keys are fragment names and the values are pieces of HTML to add to these fragments.
Here are 4 built-in fragments: 'header', 'footer', 'before', and 'after', but components may also specify fragments of their own.
To specify a new fragment, specify a new fragment by including the text "$DefineFragment(fragmentname)" in the HTML that you return.
Fragment names should only contain alphanumerics, -, and _.
If you attempt to return HTML for a fragment that doesn't exist, an exception will be thrown when the {@link GridField} is rendered.
array
getActions(GridField $gridField)
Return a list of the actions handled by this action provider.
Used to identify the action later on through the $actionName parameter in {@link handleAction}.
There is no namespacing on these actions, so you need to ensure that they don't conflict with other components.
handleAction(GridField $gridField, string $actionName, array $arguments, array $data)
Handle an action on the given {@link GridField}.
Calls ALL components for every action handled, so the component needs to ensure it only accepts actions it is actually supposed to handle.
null
handleAdd(GridField $grid)
Handles adding a new instance of a selected class.