\MultiRecordField
- Author: Jake Bentvelzen
Synopsis
class MultiRecordField
extends FormField
{
- // constants
- const SORT_INVALID = 0;
- const NEW_RECORD = 0;
- const NEW_LIST = 1;
- // members
- private static array $default_config = ;
- private static string $default_button_classes = '';
- private static boolean $enable_patch_5775 = false;
- protected $config = NULL;
- protected SS_List $list;
- protected FieldList $actions = NULL;
- protected string $titleField = '';
- protected function|string $fieldsFunction = '';
- protected boolean $fieldsFunctionFallback = false;
- protected string $modelClassName = '';
- protected integer $htmlEditorHeight = 6;
- protected string|array $sortFieldName = NULL;
- protected boolean $useToggles = true;
- protected boolean $preparedForRender = false;
- protected boolean $canAddInline = true;
- protected FieldList $children;
- protected string|null $buttonClasses = NULL;
- protected array $extraClasses = ;
- protected integer $depth = 1;
- private static $_new_records_to_write = NULL;
- private static $_existing_records_to_write = NULL;
- private static $_records_to_delete = NULL;
- // methods
- public void __construct()
- public void handleAddInline()
- public void handleRequest()
- public MultiRecordField setUseToggles()
- public boolean getUseToggles()
- public MultiRecordField setCanAddInline()
- public boolean getCanAddInline()
- public string getButtonClasses()
- public MultiRecordField setButtonClasses()
- public MultiRecordField applyButtonClasses()
- public MultiRecordField setValue()
- public MultiRecordField getConfig()
- public MultiRecordField setConfig()
- public string getModelClass()
- public MultiRecordField setModelClass()
- public MultiRecordField setModelClasses()
- public array getModelClasses()
- public array getModelClassesOrThrowExceptionIfEmpty()
- public static array convert_to_associative()
- public void getFieldID()
- public SS_List getList()
- public MultiRecordField setList()
- public MultiRecordField setForm()
- public boolean getCanSort()
- public string getTitleField()
- public MultiRecordField setTitleField()
- public string getDefaultFieldsFunction()
- public function|string getFieldsFunction()
- public MultiRecordField setFieldsFunction()
- public FieldList|null getRecordDataFields()
- public string getActionURL()
- public MultiRecordField applyUniqueFieldNames()
- public string getUniqueFieldName()
- public void saveInto()
- public FieldList Fields()
- public FieldList Actions()
- public MultiRecordField_Readonly performReadonlyTransformation()
- public FieldList getChildren()
- public string getSortFieldName()
- public MultiRecordField setSortFieldName()
- protected static array sort_string_to_array()
- protected static array get_direction_from_string()
- protected void prepareForRender()
- public void FieldHolder()
- public void Field()
Hierarchy
Extends
- FormField
Tasks
Line | Task |
---|---|
197 | (Jake): Change '->remaining' to '->shift(4)' and test. |
486 | (Jake): Improve API to allow multiple params (ie. setConfigFunction('HtmlEditorField', 'setRows', 6)) |
Constants
Name | Value |
---|---|
SORT_INVALID | 0 |
NEW_RECORD | 0 |
NEW_LIST | 1 |
Members
private
- $_existing_records_to_write
- $_new_records_to_write
- $_records_to_delete
- $default_config
—
array
Set variables or call functions on certain fields underneath this field. - $enable_patch_5775
—
boolean
Enable workaround for ListboxField bug in 'framework' 3.3 and below.
protected
- $actions — FieldList
- $canAddInline — boolean
- $children — FieldList
- $config
—
array
Defaults to default_config if not set. - $depth
—
int
How nested inside other MultiRecordField's this field is. - $extraClasses — array
- $fieldsFunction
—
function|string
Override the field function to call on the record. - $fieldsFunctionFallback
—
boolean
Whether to fallback on 'getDefaultFieldsFunction' if the $fieldsFunction is a string and doesn't exist on the record. - $htmlEditorHeight
—
int
Whether to override html editor heights - $list
—
SS_List
The list object passed into the object. - $modelClassName
—
string
Class name of the DataObject that the GridField will display. - $preparedForRender — boolean
- $sortFieldName
—
string|array
The field name to sort by. - $titleField
—
string
Field to use for the ToggleCompositeField's heading/title - $useToggles
—
boolean
Should we use toggle Composites in layout ?
Methods
protected
- get_direction_from_string()
- prepareForRender() — Prepares everything just before rendering the field
- sort_string_to_array() — Parse sort string into an array of sorts
public
- __construct()
- Actions()
- Field()
- FieldHolder()
- Fields()
- applyButtonClasses() — Apply button classes to a fieldlist of actions
- applyUniqueFieldNames() — Re-write field names to be unique ie. 'Title' to be 'ElementArea__MultiRecordField__ElementGallery__Title'
- convert_to_associative() — Convert regular array to associative, making the key the classname and the value the pretty/front-facing name.
- getActionURL()
- getButtonClasses()
- getCanAddInline()
- getCanSort()
- getChildren()
- getConfig()
- getDefaultFieldsFunction() — Get the default function to call on the record if $this->fieldsFunction isn't set.
- getFieldID() — @return int|string
- getFieldsFunction() — Get closure or string of the function to call for getting record fields.
- getList()
- getModelClass() — Gets the first model class from list.
- getModelClasses()
- getModelClassesOrThrowExceptionIfEmpty()
- getRecordDataFields()
- getSortFieldName()
- getTitleField() — Get the field to use for the ToggleCompositeField's heading/title
- getUniqueFieldName()
- getUseToggles()
- handleAddInline()
- handleRequest()
- performReadonlyTransformation() — Returns a read-only version of this field.
- saveInto()
- setButtonClasses() — Set the classes to be applied on each FormAction field.
- setCanAddInline()
- setConfig()
- setFieldsFunction() — Set the function to call on the $record for determining what fields to show.
- setForm()
- setList()
- setModelClass() — Set one model class.
- setModelClasses() — If array, can be formatted like so: array('MyClass', 'MyOtherClass') -or- array('MyClass' => 'Nice Name 1', 'MyOtherClass' => 'Nice Name 2')
- setSortFieldName() — Set what field to use for sorting the records.
- setTitleField() — Set the field to use for the ToggleCompositeField's heading/title
- setUseToggles()
- setValue()