diff --git a/src/GridFieldAddExistingSearchHandler.php b/src/GridFieldAddExistingSearchHandler.php index 58de381..a3918e8 100644 --- a/src/GridFieldAddExistingSearchHandler.php +++ b/src/GridFieldAddExistingSearchHandler.php @@ -96,7 +96,7 @@ class GridFieldAddExistingSearchHandler extends RequestHandler { $list = $this->context->getQuery($data, false, false, $this->getSearchList()); $list = $list->subtract($this->grid->getList()); - $list = new PaginatedList($list, $this->request); + $list = PaginatedList::create($list, $this->request); $data = $this->customise(array( 'SearchForm' => $form, @@ -109,7 +109,7 @@ class GridFieldAddExistingSearchHandler extends RequestHandler { $list = $this->getSearchList(); $list = $list->subtract($this->grid->getList()); - $list = new PaginatedList($list, $this->request); + $list = PaginatedList::create($list, $this->request); return $list; } diff --git a/src/GridFieldAddNewInlineButton.php b/src/GridFieldAddNewInlineButton.php index 519519b..aabb8c6 100755 --- a/src/GridFieldAddNewInlineButton.php +++ b/src/GridFieldAddNewInlineButton.php @@ -102,7 +102,7 @@ class GridFieldAddNewInlineButton implements GridField_HTMLProvider, GridField_S Requirements::javascript('symbiote/silverstripe-gridfieldextensions:javascript/tmpl.js'); GridFieldExtensions::include_requirements(); - $data = new ArrayData(array( + $data = ArrayData::create(array( 'Title' => $this->getTitle(), )); @@ -114,7 +114,7 @@ class GridFieldAddNewInlineButton implements GridField_HTMLProvider, GridField_S private function getRowTemplate(GridField $grid, GridFieldEditableColumns $editable) { - $columns = new ArrayList(); + $columns = ArrayList::create(); $handled = array_keys($editable->getDisplayFields($grid)); if ($grid->getList()) { @@ -161,7 +161,7 @@ class GridFieldAddNewInlineButton implements GridField_HTMLProvider, GridField_S $attrs .= sprintf(' %s="%s"', $attr, Convert::raw2att($val)); } - $columns->push(new ArrayData(array( + $columns->push(ArrayData::create(array( 'Content' => $content, 'Attributes' => DBField::create_field('HTMLFragment', $attrs), 'IsActions' => $column == 'Actions' diff --git a/src/GridFieldAddNewMultiClass.php b/src/GridFieldAddNewMultiClass.php index e71da83..1073794 100755 --- a/src/GridFieldAddNewMultiClass.php +++ b/src/GridFieldAddNewMultiClass.php @@ -244,13 +244,18 @@ class GridFieldAddNewMultiClass implements GridField_HTMLProvider, GridField_URL GridFieldExtensions::include_requirements(); - $field = new DropdownField(sprintf('%s[%s]', __CLASS__, $grid->getName()), '', $classes, $this->defaultClass); + $field = DropdownField::create( + sprintf('%s[%s]', __CLASS__, $grid->getName()), + '', + $classes, + $this->defaultClass + ); if (Config::inst()->get(__CLASS__, 'showEmptyString')) { $field->setEmptyString(_t('GridFieldExtensions.SELECTTYPETOCREATE', '(Select type to create)')); } $field->addExtraClass('no-change-track'); - $data = new ArrayData(array( + $data = ArrayData::create(array( 'Title' => $this->getTitle(), 'Link' => Controller::join_links($grid->Link(), 'add-multi-class', '{class}'), 'ClassField' => $field diff --git a/src/GridFieldEditableColumns.php b/src/GridFieldEditableColumns.php index 10d4cc1..5f48c5f 100644 --- a/src/GridFieldEditableColumns.php +++ b/src/GridFieldEditableColumns.php @@ -83,7 +83,7 @@ class GridFieldEditableColumns extends GridFieldDataColumns implements // Fall back to previous logic if (!$field) { $rel = (strpos($col, '.') === false); // field references a relation value - $field = ($rel) ? clone $fields->fieldByName($col) : new ReadonlyField($col); + $field = ($rel) ? clone $fields->fieldByName($col) : ReadonlyField::create($col); } if (!$field) { @@ -211,7 +211,7 @@ class GridFieldEditableColumns extends GridFieldDataColumns implements public function getFields(GridField $grid, DataObjectInterface $record) { $cols = $this->getDisplayFields($grid); - $fields = new FieldList(); + $fields = FieldList::create(); /** @var DataList $list */ $list = $grid->getList(); @@ -263,12 +263,12 @@ class GridFieldEditableColumns extends GridFieldDataColumns implements if ($class && $obj = DataObject::singleton($class)->dbObject($colRelation[0])) { $field = $obj->scaffoldFormField(); } else { - $field = new ReadonlyField($colRelation[0]); + $field = ReadonlyField::create($colRelation[0]); } } elseif ($class && $obj = DataObject::singleton($class)->dbObject($col)) { $field = $obj->scaffoldFormField(); } else { - $field = new ReadonlyField($col); + $field = ReadonlyField::create($col); } } @@ -301,7 +301,7 @@ class GridFieldEditableColumns extends GridFieldDataColumns implements { $fields = $this->getFields($grid, $record); - $form = new Form($grid, null, $fields, new FieldList()); + $form = Form::create($grid, null, $fields, FieldList::create()); $form->loadDataFrom($record); $form->setFormAction(Controller::join_links( diff --git a/src/GridFieldExternalLink.php b/src/GridFieldExternalLink.php index 82126ae..75dcdd1 100644 --- a/src/GridFieldExternalLink.php +++ b/src/GridFieldExternalLink.php @@ -72,7 +72,7 @@ class GridFieldExternalLink extends GridFieldDataColumns */ public function getColumnContent($gridField, $record, $columnName) { - $data = new ArrayData(array( + $data = ArrayData::create(array( 'Link' => $record->hasMethod('getExternalLink') ? $record->getExternalLink() : $record->ExternalLink, 'Text' => $record->hasMethod('getExternalLinkText') ? $record->getExternalLinkText() : 'External Link' )); diff --git a/src/GridFieldRequestHandler.php b/src/GridFieldRequestHandler.php index fe73d86..cd95508 100644 --- a/src/GridFieldRequestHandler.php +++ b/src/GridFieldRequestHandler.php @@ -83,11 +83,11 @@ abstract class GridFieldRequestHandler extends RequestHandler */ public function Form() { - $form = new Form( + $form = Form::create( $this, 'SilverStripe\\Forms\\Form', - new FieldList($root = new TabSet('Root', new Tab('Main'))), - new FieldList() + FieldList::create($root = TabSet::create('Root', Tab::create('Main'))), + FieldList::create() ); if ($this->getTopLevelController() instanceof LeftAndMain) { @@ -136,7 +136,7 @@ abstract class GridFieldRequestHandler extends RequestHandler if ($controller->hasMethod('Breadcrumbs')) { return $controller->Breadcrumbs(); } else { - return new ArrayList(); + return ArrayList::create(); } } diff --git a/src/GridFieldTitleHeader.php b/src/GridFieldTitleHeader.php index fdb3c3b..442035c 100644 --- a/src/GridFieldTitleHeader.php +++ b/src/GridFieldTitleHeader.php @@ -14,12 +14,12 @@ class GridFieldTitleHeader implements GridField_HTMLProvider public function getHTMLFragments($grid) { - $cols = new ArrayList(); + $cols = ArrayList::create(); foreach ($grid->getColumns() as $name) { $meta = $grid->getColumnMetadata($name); - $cols->push(new ArrayData(array( + $cols->push(ArrayData::create(array( 'Name' => $name, 'Title' => $meta['title'] )));