\GridFieldAddByDBField
Adds a component which allows a user to add a new DataObject by database field.
- Author: Michael Strong <github@michaelstrong.co.uk>
Synopsis
class GridFieldAddByDBField
implements
GridField_ActionProvider,GridField_HTMLProvider
{
- // members
- protected $targetFragment;
- protected string $dataObjectField = "Title";
- // methods
- public void __construct()
- public array getActions()
- public void handleAction()
- public string getHTMLFragments()
- public string getDataObjectField()
- public void setDataObjectField()
Hierarchy
Implements
- GridField_ActionProvider
- GridField_HTMLProvider
Members
protected
- $dataObjectField
—
string
Default field to create the dataobject by should be Title. - $targetFragment
—
string
HTML Fragment to render the field.
Methods
public
- __construct() — Creates a text field and add button which allows the user to directly create a new DataObject by just entering the title.
- getActions() — Provide actions to this component.
- getDataObjectField() — Returns the database field for which we'll add the new data object.
- getHTMLFragments() — Renders the TextField and add button to the GridField.
- handleAction() — Handles the add action for the given DataObject
- setDataObjectField() — Set the database field.