public function __construct($name, $title = null, SS_List $dataList = null, PublishableGridFieldConfig $config = null) { $config = $config ?: PublishableGridFieldConfig_Base::create(); parent::__construct($name, $title, $dataList, $config); Requirements::css('publishable/css/PublishableGridField.css'); Requirements::javascript('publishable/javascript/PublishableGridField.js'); }
public function __construct($name, $title, $parent) { $this->record = $parent->{$name}(); $this->parent = $parent; $config = GridFieldConfig::create()->addComponent(new GridFieldDetailForm())->addComponent(new GridFieldHasOneEditButton()); $list = new HasOneButtonRelationList($this->record, $name, $parent); parent::__construct($name, $title, $list, $config); }
public function __construct($name, $title = null, SS_List $dataList = null) { parent::__construct($name, $title, $dataList); $config = new GridFieldConfig_RecordEditor(); $config->removeComponentsByType('GridFieldDeleteAction'); $config->removeComponentsByType('GridFieldDetailForm'); $config->addComponent(new PageHolderGridFieldDetailForm()); $config->addComponent(new GridFieldPageHistoryButton(), 'GridFieldPageCount'); $this->setConfig($config); }
/** * Create GridField for FeedBlocks */ function __construct($name, $title = null, SS_List $dataList = null, GridFieldConfig $config = null) { if (!$config) { $config = GridFieldConfig::create()->addComponents(new GridFieldToolbarHeader(), new GridFieldAddNewButton('toolbar-header-right'), new GridFieldSortableHeader(), new GridFieldDataColumns(), new GridFieldPaginator(20), new FeedBlock_GridFieldRefreshButton(), new GridFieldEditButton(), new GridFieldDeleteAction(), new FeedBlock_GridFieldDetailForm()); if (count($dataList) > 1 && class_exists('GridFieldSortableRows')) { $config->addComponent(new GridFieldSortableRows('SortOrder')); } } parent::__construct($name, $title, $dataList, $config); }
/** * Creates a new GridField field * @param {string} $name Name of the GridField * @param {string} $title Title of the GridField * @param {SS_List} $dataList Data List to use in the GridField * @param {GridFieldConfig} $config GridField Configuration to use */ public function __construct($name, $title = null, SS_List $dataList = null, GridFieldConfig $config = null) { $this->name = $name; $state = new StatefulGridFieldState($this); //Replace the state with a StatefulGridField_State instance $this->state = $state; parent::__construct($name, $title, $dataList, $config); //Replace the state with a StatefulGridField_State instance $this->state = $state; $this->getConfig()->removeComponentsByType('GridState_Component')->addComponent(new StatefulGridFieldState_Component()); }
/** * Usage [e.g. in getCMSFields] * $field = new PickerField('Authors', 'Selected Authors', $this->Authors(), 'Select Author(s)'); * * @param string $name - Name of field (typically the relationship method) * @param string $title - GridField Title * @param SS_List $dataList - Result of the relationship component method (E.g. $this->Authors()) * @param string $linkExistingTitle - AddExisting Button Title * @param string $sortField - Field to sort on. Be sure it exists in the $many_many_extraFields static */ public function __construct($name, $title = null, SS_List $dataList = null, $linkExistingTitle = null, $sortField = null) { $config = GridfieldConfig::create()->addComponents(new GridFieldButtonRow('before'), new GridFieldToolbarHeader(), new GridFieldDataColumns(), new GridFieldTitleHeader(), new GridFieldPaginator(), new PickerFieldAddExistingSearchButton(), new PickerFieldDeleteAction()); if ($sortField) { $config->addComponent(new GridFieldOrderableRows($sortField)); } if (!$linkExistingTitle) { $linkExistingTitle = $this->isHaveOne() ? 'Select a ' . $dataList->dataClass() : 'Select ' . $dataList->dataClass() . '(s)'; // plural [has_many, many_many] } $config->getComponentByType('PickerFieldAddExistingSearchButton')->setTitle($linkExistingTitle); return parent::__construct($name, $title, $dataList, $config); }
public function __construct($name, $title = null, SS_List $dataList = null, GridFieldConfig $config = null) { parent::__construct($name, $title, $dataList, $config); $this->addExtraClass('ss-tiled-gridfield'); }
/** * @param string $name * @param null $title * @param SS_List|null $dataList * @param GridFieldConfig|null $config */ public function __construct($name, $title = null, SS_List $dataList = null, GridFieldConfig $config = null) { parent::__construct($name, $title, $dataList, $config); $this->getConfig()->addComponent(new GridFieldButtonRow('after')); $this->getConfig()->addComponent(new ResetGridStateButton('buttons-after-right')); }