Sunnysideup\CMSNiceties\Forms\CMSNicetiesEasyRelationshipField
usage: $fields->addFieldToTab( 'Root.RelationFoo', CMSNicetiesEasyRelationshipField::create($this, 'RelationFoo') ->setSortField('SortOrder') ->setLabelForField('Check this Out') ->setHasEditRelation(true) ->setHasUnlink(true) ->setHasDelete(true) ->setHasAdd(true) ->setHasAddExisting(true) ->setMaxItemsForCheckBoxSet(150) ->setDataColumns(['Title' => 'My Title']) ->setSearchFields(['Title' => 'My Title']) ->setSearchOutputFormat('') );.
Synopsis
class CMSNicetiesEasyRelationshipField
extends CompositeField
{
- // members
- protected $callingObject;
- protected string $relationName = '';
- protected string $relationClassName = '';
- protected string $sortField = '';
- protected array|string $checkBoxSort;
- protected string $labelForField = '';
- protected string $addLabel = '';
- protected bool $hasEditRelation = true;
- protected bool $hasUnlink = true;
- protected bool $hasDelete = true;
- protected bool $hasAdd = true;
- protected bool $hasAddExisting = true;
- protected integer $maxItemsForCheckBoxSet = 300;
- protected array $dataColumns = ;
- protected array $searchFields = ;
- protected string $searchOutputFormat = '';
- private null|GridFieldConfig $gridFieldConfig;
- private null|GridField $gridField;
- private null|CheckboxSetFieldWithLinks $checkboxSetField;
- private null|DataList $dataListForCheckboxSetField;
- // methods
- public array __construct()
- public void doBuild()
- public void setSortField()
- public void setCheckBoxSort()
- public void setLabelForField()
- public void setAddLabel()
- public void setHasEditRelation()
- public void setHasUnlink()
- public void setHasDelete()
- public void setHasAdd()
- public void setHasAddExisting()
- public void setMaxItemsForCheckBoxSet()
- public void setDataColumns()
- public void setSearchFields()
- public void setSearchOutputFormat()
- public void setDataListForCheckboxSetField()
- public void getDetailedFields()
- public void setDetailedFields()
- public FieldList getChildren()
- public void getGridFieldConfig()
- public void getGritField()
- public void getCheckboxSetField()
- protected void listIsEmpty()
- protected void checkIfFieldsHaveBeenBuilt()
- protected GridFieldDetailForm|VersionedGridFieldDetailForm getDetailedForm()
- private void getRelationClassName()
- private void isVersioned()
- private void hasCheckboxSet()
- private void hasGridField()
- private void getSortField()
Hierarchy
Extends
- SilverStripe\Forms\CompositeField
Tasks
Line | Task |
---|---|
569 | - add undefinedoffset/sortablegridfield |
Members
private
- $checkboxSetField — Sunnysideup\CMSNiceties\Forms\null|CheckboxSetFieldWithLinks
- $dataListForCheckboxSetField — Sunnysideup\CMSNiceties\Forms\null|DataList
- $gridField — Sunnysideup\CMSNiceties\Forms\null|GridField
- $gridFieldConfig — Sunnysideup\CMSNiceties\Forms\null|GridFieldConfig
protected
- $addLabel
—
string
name for Add - e.g. My Product resulting in a button "Add My Product". - $callingObject
—
the object calling this class, aka the class where we add the fields. - $checkBoxSort — Sunnysideup\CMSNiceties\Forms\array|string
- $dataColumns
—
array
data columns. - $hasAdd
—
Sunnysideup\CMSNiceties\Forms\bool
can new items be added? - $hasAddExisting
—
Sunnysideup\CMSNiceties\Forms\bool
can existing items be linked? - $hasDelete
—
Sunnysideup\CMSNiceties\Forms\bool
can the linked item be deleted? - $hasEditRelation
—
Sunnysideup\CMSNiceties\Forms\bool
should the relationship be editable in the form? - $hasUnlink
—
Sunnysideup\CMSNiceties\Forms\bool
can the link be removed? - $labelForField
—
string
heading above field. - $maxItemsForCheckBoxSet — int
- $relationClassName
—
string
name of the class that we are linking to. - $relationName
—
string
name of the relations e.g. Members as defined in has_many or many_many. - $searchFields
—
array
data columns. - $searchOutputFormat
—
string
data columns. - $sortField
—
string
name of the sort field used works with: - UndefinedOffset\SortableGridField\Forms\GridFieldSortableRows.
Methods
private
protected
public
- __construct() — provides a generic Grid Field for Many Many relations.
- doBuild()
- getCheckboxSetField()
- getChildren()
- getDetailedFields()
- getGridFieldConfig()
- getGritField()
- setAddLabel()
- setCheckBoxSort()
- setDataColumns()
- setDataListForCheckboxSetField()
- setDetailedFields()
- setHasAdd()
- setHasAddExisting()
- setHasDelete()
- setHasEditRelation()
- setHasUnlink()
- setLabelForField()
- setMaxItemsForCheckBoxSet()
- setSearchFields()
- setSearchOutputFormat()
- setSortField()