mirror of
https://github.com/silverstripe/silverstripe-frameworktest
synced 2024-10-22 11:06:02 +02:00
BUGFIX: Make frameworktest rely on built-in gridfield configs
This commit is contained in:
parent
d37bd9d306
commit
b67f99adbe
@ -37,14 +37,7 @@ class Company extends DataObject {
|
||||
$fields->add(new TextField('Revenue', 'Revenue', $this->Revenue));
|
||||
$fields->add(new TextField('CEO', 'CEO', $this->CEO));
|
||||
|
||||
$config = new GridFieldConfig();
|
||||
$config->addComponent(new GridFieldRelationAdd('Name'));
|
||||
$config->addComponent(new GridFieldDefaultColumns());
|
||||
$config->addComponent(new GridFieldSortableHeader());
|
||||
$config->addComponent(new GridFieldPaginator());
|
||||
$config->addComponent(new GridFieldDeleteAction());
|
||||
$config->addComponent(new GridFieldRelationDelete());
|
||||
$config->addComponent(new GridFieldPopupForms());
|
||||
$config = new GridFieldConfig_RelationEditor();
|
||||
|
||||
$gridField = new GridField('Employees', 'Employees', $this->Employees(), $config);
|
||||
$fields->add($gridField);
|
||||
|
@ -31,36 +31,15 @@ class GridFieldTestPage extends Page {
|
||||
public function getCMSFields() {
|
||||
$fields = parent::getCMSFields();
|
||||
|
||||
$config = new GridFieldConfig();
|
||||
$config->addComponent(new GridFieldDefaultColumns());
|
||||
$config->addComponent(new GridFieldSortableHeader());
|
||||
$config->addComponent(new GridFieldPaginator);
|
||||
$config->addComponent(new GridFieldFilter());
|
||||
$config->addComponent(new GridFieldDeleteAction());
|
||||
$config->addComponent(new GridFieldEditAction());
|
||||
$config->addComponent($forms = new GridFieldPopupForms());
|
||||
$config = new GridFieldConfig_RecordEditor();
|
||||
$grid = new GridField('Companies', 'Companies', new DataList('Company'),$config);
|
||||
$fields->addFieldToTab('Root.NoRelation', $grid);
|
||||
|
||||
$config = new GridFieldConfig();
|
||||
$config->addComponent(new GridFieldDefaultColumns());
|
||||
$config->addComponent(new GridFieldSortableHeader());
|
||||
$config->addComponent(new GridFieldPaginator);
|
||||
$config->addComponent(new GridFieldFilter());
|
||||
$config->addComponent(new GridFieldDeleteAction());
|
||||
$config->addComponent(new GridFieldEditAction());
|
||||
$config->addComponent(new GridFieldRelationAdd('Name'));
|
||||
$config = new GridFieldConfig_RelationEditor();
|
||||
$grid = new GridField('HasManyCompanies', 'HasManyCompanies', new DataList('Company'),$config);
|
||||
$fields->addFieldToTab('Root.HasMany', $grid);
|
||||
|
||||
$config = new GridFieldConfig();
|
||||
$config->addComponent(new GridFieldDefaultColumns());
|
||||
$config->addComponent(new GridFieldSortableHeader());
|
||||
$config->addComponent(new GridFieldPaginator);
|
||||
$config->addComponent(new GridFieldFilter());
|
||||
$config->addComponent(new GridFieldDeleteAction());
|
||||
$config->addComponent(new GridFieldEditAction());
|
||||
$config->addComponent(new GridFieldRelationAdd('Name'));
|
||||
$config = new GridFieldConfig_RelationEditor();
|
||||
$grid = new GridField('ManyManyCompanies', 'ManyManyCompanies', new DataList('Company'),$config);
|
||||
$fields->addFieldToTab('Root.ManyMany', $grid);
|
||||
|
||||
@ -86,14 +65,7 @@ class GridFieldTestPage_Controller extends Page_Controller {
|
||||
* @return Form
|
||||
*/
|
||||
public function Form(){
|
||||
$config = new GridFieldConfig();
|
||||
$config->addComponent(new GridFieldDefaultColumns());
|
||||
$config->addComponent(new GridFieldSortableHeader());
|
||||
$config->addComponent(new GridFieldPaginator);
|
||||
$config->addComponent(new GridFieldFilter());
|
||||
$config->addComponent(new GridFieldDeleteAction());
|
||||
$config->addComponent(new GridFieldEditAction());
|
||||
$config->addComponent(new GridFieldPopupForms());
|
||||
$config = new GridFieldConfig_RecordEditor();
|
||||
|
||||
$grid = new GridField('Companies', 'Companies', new DataList('Company'),$config);
|
||||
return new Form($this,'Form',new FieldList($grid),new FieldList());
|
||||
|
Loading…
Reference in New Issue
Block a user