OP\Fields\TileField
Creates a reorderable 2D tile field. For example: <code> private static $has_many = [ 'Tiles' => Tile::class ]; private static $owns = [ 'Tiles' ];
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Main', TileField::create('Tiles', 'Tiles', $this->Tiles()));
}
</code>
Synopsis
class TileField
extends GridField
{
- // members
- private static array $allowed_actions = ;
- private static array $url_handlers = ;
- protected $widthholder = NULL;
- protected integer $defaultrows = 4;
- protected SS_List $selectionlist = NULL;
- // methods
- public void __construct()
- public HTTP delete()
- public type FieldHolder()
- public ArrayList Options()
- public type Field()
- public string getAddURL()
- public string getEditURL()
- public string getDeleteURL()
- public html handleRequest()
- public ArrayList getTileTypes()
- public json getTileTypesJson()
- public int getRows()
- public json getDataListJson()
- public $this setValue()
- public void RowsEnabled()
- public void getAttributesJson()
- public array getAttributes()
Hierarchy
Extends
- SilverStripe\Forms\GridField\GridField
Members
private
- $allowed_actions
- $url_handlers
protected
- $defaultrows
- $selectionlist
—
SilverStripe\ORM\SS_List
The list of avalible items to select from - $widthholder
Methods
public
- __construct() — include the required js/css
- Field() — Creates a rendered Programme Crawler Field using the .ss template
- FieldHolder() — override the gridfield render method. we want to render using TileField.ss
- Options() — returns a list of palatable dataobjects used for the template render
- RowsEnabled()
- delete() — handles a delete request via ajax
- getAddURL() — will return the link that is used to create new tile objects
- getAttributes() — Allows customization through an 'updateAttributes' hook on the base class.
- getAttributesJson()
- getDataListJson() — a list of items inside this area. mapped to react-grid-layout
- getDeleteURL() — will return the link that is used to remove tile objects
- getEditURL() — will return the link that is used to edit tile objects
- getRows() — return the number of rows
- getTileTypes() — get file types
- getTileTypesJson() — tiles we're allowed to create
- handleRequest() — we intercept the request to figure out what tile class we're using. we then inform the parent gridfield through a custom component (TileFieldDetailForm)
- setValue() — saving the grid structure via clicking 'save'