BUGFIX: Make frameworktest rely on built-in gridfield configs

This commit is contained in:
Sam Minnee 2012-03-09 18:24:18 +13:00
parent d37bd9d306
commit b67f99adbe
2 changed files with 5 additions and 40 deletions

View File

@ -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);

View File

@ -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());