UncleCheese\BetterButtons\Extensions\BetterButtonDataObject
An extension that offers features to DataObjects that allow them to set their own actions and utilities for {@link GridFieldDetailForm}
Default buttons are defined in _config.yml and can be overriden via the Config layer.
Due to the way Config merges arrays, set button class names to "false" to remove them from the list.
- Author: Uncle Cheese <unclecheese@leftandmain.com>
Synopsis
class BetterButtonDataObject
extends DataExtension
{
- // members
- private static bool $better_buttons_enabled = true;
- private static bool $better_buttons_versioned_enabled = true;
- // methods
- public FieldList getBetterButtonsActions()
- public FormAction findActionByName()
- public FieldList getBetterButtonsUtils()
- protected array getDefaultButtonList()
- protected FieldList createFieldList()
- protected BetterButton instantiateButton()
- protected DropdownFormAction createButtonGroup()
- public boolean checkVersioned()
- public boolean isCustomActionAllowed()
Hierarchy
Extends
- SilverStripe\ORM\DataExtension
Members
private
Methods
protected
- createButtonGroup() — Creates a button group {@link DropdownFormAction}
- createFieldList() — Transforms a list of configured buttons into a usable FieldList
- getDefaultButtonList() — Gets an array of all the default buttons as defined in the config
- instantiateButton() — Transforms a given button class name into an actual object.
public
- checkVersioned() — Determines if the record is using the {@link Versioned} extension
- findActionByName() — Gets a FormAction or BetterButtonCustomAction by name, in utils or actions
- getBetterButtonsActions() — Gets the default actions for all DataObjects. Can be overloaded in subclasses <code> public function getBetterButtonsActions() { $actions = parent::getBetterButtonsActions(); $actions->push(BetterButtonCustomAction::create('myaction','Do something to this record'));
- getBetterButtonsUtils() — Gets the default utils for all DataObjects. Can be overloaded in subclasses.
- isCustomActionAllowed() — Checks if a custom action is allowed to be called against a model.