mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
MINOR Using late static binding instead of Object::create() calls
This commit is contained in:
parent
6517f4496b
commit
40d73127ae
@ -969,7 +969,7 @@ class LeftAndMain extends Controller implements PermissionProvider {
|
||||
* Return the CMS's HTML-editor toolbar
|
||||
*/
|
||||
public function EditorToolbar() {
|
||||
return Object::create('HtmlEditorField_Toolbar', $this, "EditorToolbar");
|
||||
return HtmlEditorField_Toolbar::create($this, "EditorToolbar");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1032,7 +1032,7 @@ class LeftAndMain extends Controller implements PermissionProvider {
|
||||
'BatchActionsForm',
|
||||
new FieldList(
|
||||
new HiddenField('csvIDs'),
|
||||
Object::create('DropdownField',
|
||||
DropdownField::create(
|
||||
'Action',
|
||||
false,
|
||||
$actionsMap
|
||||
|
@ -117,7 +117,7 @@ abstract class ModelAdmin extends LeftAndMain {
|
||||
$list = $this->getList();
|
||||
$exportButton = new GridFieldExportButton();
|
||||
$exportButton->setExportColumns($this->getExportFields());
|
||||
$listField = Object::create('GridField',
|
||||
$listField = GridField::create(
|
||||
$this->modelClass,
|
||||
false,
|
||||
$list,
|
||||
@ -180,9 +180,9 @@ abstract class ModelAdmin extends LeftAndMain {
|
||||
$form = new Form($this, "SearchForm",
|
||||
$context->getSearchFields(),
|
||||
new FieldList(
|
||||
Object::create('ResetFormAction','clearsearch', _t('ModelAdmin.CLEAR_SEARCH','Clear Search'))
|
||||
ResetFormAction::create('clearsearch', _t('ModelAdmin.CLEAR_SEARCH','Clear Search'))
|
||||
->setUseButtonTag(true)->addExtraClass('ss-ui-action-minor'),
|
||||
Object::create('FormAction', 'search', _t('MemberTableField.SEARCH', 'Search'))
|
||||
FormAction::create('search', _t('MemberTableField.SEARCH', 'Search'))
|
||||
->setUseButtonTag(true)
|
||||
),
|
||||
new RequiredFields()
|
||||
|
@ -43,7 +43,7 @@ class SecurityAdmin extends LeftAndMain implements PermissionProvider {
|
||||
$record = $this->getRecord($id);
|
||||
if($record && !$record->canView()) return Security::permissionFailure($this);
|
||||
|
||||
$memberList = Object::create('GridField',
|
||||
$memberList = GridField::create(
|
||||
'Members',
|
||||
false,
|
||||
DataList::create('Member'),
|
||||
@ -52,8 +52,7 @@ class SecurityAdmin extends LeftAndMain implements PermissionProvider {
|
||||
)->addExtraClass("members_grid");
|
||||
$memberListConfig->getComponentByType('GridFieldDetailForm')->setValidator(new Member_Validator());
|
||||
|
||||
$groupList = Object::create('GridField',
|
||||
'Groups',
|
||||
$groupList = GridField::create( 'Groups',
|
||||
false,
|
||||
DataList::create('Group'),
|
||||
GridFieldConfig_RecordEditor::create()
|
||||
@ -104,8 +103,7 @@ class SecurityAdmin extends LeftAndMain implements PermissionProvider {
|
||||
|
||||
// Add roles editing interface
|
||||
if(Permission::check('APPLY_ROLES')) {
|
||||
$rolesField = Object::create('GridField',
|
||||
'Roles',
|
||||
$rolesField = GridField::create( 'Roles',
|
||||
false,
|
||||
DataList::create('PermissionRole'),
|
||||
GridFieldConfig_RecordEditor::create()
|
||||
|
@ -320,7 +320,7 @@ class Convert {
|
||||
* @return string
|
||||
*/
|
||||
public static function raw2url($title) {
|
||||
$f = Object::create('URLSegmentFilter');
|
||||
$f = URLSegmentFilter::create();
|
||||
return $f->filter($title);
|
||||
}
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ abstract class Object {
|
||||
* or calling on Object and passing the class name as the first parameter. The following
|
||||
* are equivalent:
|
||||
* $list = DataList::create('SiteTree');
|
||||
* $list = Object::create('DataList', 'SiteTree');
|
||||
* $list = DataList::create('SiteTree');
|
||||
*
|
||||
* @param string $class the class name
|
||||
* @param mixed $arguments,... arguments to pass to the constructor
|
||||
@ -121,7 +121,7 @@ abstract class Object {
|
||||
* are respected.
|
||||
*
|
||||
* `Object::create_from_string("Versioned('Stage','Live')")` will return the result of
|
||||
* `Object::create('Versioned', 'Stage', 'Live);`
|
||||
* `Versioned::create('Stage', 'Live);`
|
||||
*
|
||||
* It is designed for simple, clonable objects. The first time this method is called for a given
|
||||
* string it is cached, and clones of that object are returned.
|
||||
@ -130,7 +130,7 @@ abstract class Object {
|
||||
* impossible to pass null as the firstArg argument.
|
||||
*
|
||||
* `Object::create_from_string("Varchar(50)", "MyField")` will return the result of
|
||||
* `Object::create('Vachar', 'MyField', '50');`
|
||||
* `Vachar::create('MyField', '50');`
|
||||
*
|
||||
* Arguments are always strings, although this is a quirk of the current implementation rather
|
||||
* than something that can be relied upon.
|
||||
|
@ -92,7 +92,7 @@ class DevelopmentAdmin extends Controller {
|
||||
// This action is sake-only right now.
|
||||
unset($actions["modules/add"]);
|
||||
|
||||
$renderer = Object::create('DebugView');
|
||||
$renderer = DebugView::create();
|
||||
$renderer->writeHeader();
|
||||
$renderer->writeInfo("Sapphire Development Tools", Director::absoluteBaseURL());
|
||||
$base = Director::baseURL();
|
||||
@ -116,33 +116,33 @@ class DevelopmentAdmin extends Controller {
|
||||
}
|
||||
|
||||
function tests($request) {
|
||||
return Object::create('TestRunner');
|
||||
return TestRunner::create();
|
||||
}
|
||||
|
||||
function jstests($request) {
|
||||
return Object::create('JSTestRunner');
|
||||
return JSTestRunner::create();
|
||||
}
|
||||
|
||||
function tasks() {
|
||||
return Object::create('TaskRunner');
|
||||
return TaskRunner::create();
|
||||
}
|
||||
|
||||
function viewmodel() {
|
||||
return Object::create('ModelViewer');
|
||||
return ModelViewer::create();
|
||||
}
|
||||
|
||||
function build($request) {
|
||||
if(Director::is_cli()) {
|
||||
$da = Object::create('DatabaseAdmin');
|
||||
$da = DatabaseAdmin::create();
|
||||
return $da->handleRequest($request, $this->model);
|
||||
} else {
|
||||
$renderer = Object::create('DebugView');
|
||||
$renderer = DebugView::create();
|
||||
$renderer->writeHeader();
|
||||
$renderer->writeInfo("Environment Builder", Director::absoluteBaseURL());
|
||||
echo "<div style=\"margin: 0 2em\">";
|
||||
echo "<div class=\"status pending\"><h2 class='buildProgress'>Database is building.... Check below for any errors</h2><h2 class='buildCompleted'>Database has been built successfully</h2></div>";
|
||||
|
||||
$da = Object::create('DatabaseAdmin');
|
||||
$da = DatabaseAdmin::create();
|
||||
return $da->handleRequest($request, $this->model);
|
||||
|
||||
echo "</div>";
|
||||
@ -157,10 +157,10 @@ class DevelopmentAdmin extends Controller {
|
||||
* 'build/defaults' => 'buildDefaults',
|
||||
*/
|
||||
function buildDefaults() {
|
||||
$da = Object::create('DatabaseAdmin');
|
||||
$da = DatabaseAdmin::create();
|
||||
|
||||
if (!Director::is_cli()) {
|
||||
$renderer = Object::create('DebugView');
|
||||
$renderer = DebugView::create();
|
||||
$renderer->writeHeader();
|
||||
$renderer->writeInfo("Defaults Builder", Director::absoluteBaseURL());
|
||||
echo "<div style=\"margin: 0 2em\">";
|
||||
@ -189,6 +189,6 @@ class DevelopmentAdmin extends Controller {
|
||||
}
|
||||
|
||||
function viewcode($request) {
|
||||
return Object::create('CodeViewer');
|
||||
return CodeViewer::create();
|
||||
}
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ of the CMS you have to take care of instanciation yourself:
|
||||
// File: mysite/code/MyController.php
|
||||
class MyObjectController extends Controller {
|
||||
public function EditorToolbar() {
|
||||
return Object::create('HtmlEditorField_Toolbar', $this, "EditorToolbar");
|
||||
return HtmlEditorField_Toolbar::create($this, "EditorToolbar");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -213,8 +213,8 @@ PHP:
|
||||
public function search($request) {
|
||||
$htmlTitle = '<p>Your results for:' . Convert::raw2xml($request->getVar('Query')) . '</p>';
|
||||
return $this->customise(array(
|
||||
'Query' => DBField::create('Text', $request->getVar('Query')),
|
||||
'HTMLTitle' => DBField::create('HTMLText', $htmlTitle)
|
||||
'Query' => Text::create($request->getVar('Query')),
|
||||
'HTMLTitle' => HTMLText::create($htmlTitle)
|
||||
));
|
||||
}
|
||||
}
|
||||
@ -243,7 +243,7 @@ PHP:
|
||||
$rssRelativeLink = "/rss?Query=" . urlencode($_REQUEST['query']) . "&sortOrder=asc";
|
||||
$rssLink = Controller::join_links($this->Link(), $rssRelativeLink);
|
||||
return $this->customise(array(
|
||||
"RSSLink" => DBField::create("Text", $rssLink),
|
||||
"RSSLink" => Text::create($rssLink),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
@ -349,12 +349,12 @@ class File extends DataObject {
|
||||
}
|
||||
|
||||
//create the file attributes in a FieldGroup
|
||||
$filePreview = FormField::create('CompositeField',
|
||||
FormField::create('CompositeField',
|
||||
$filePreview = CompositeField::create(
|
||||
CompositeField::create(
|
||||
$previewField
|
||||
)->setName("FilePreviewImage")->addExtraClass('cms-file-info-preview'),
|
||||
FormField::create('CompositeField',
|
||||
FormField::create('CompositeField',
|
||||
CompositeField::create(
|
||||
CompositeField::create(
|
||||
new ReadonlyField("FileType", _t('AssetTableField.TYPE','File type') . ':'),
|
||||
new ReadonlyField("Size", _t('AssetTableField.SIZE','File size') . ':', $this->getSize()),
|
||||
$urlField = new ReadonlyField('ClickableURL', _t('AssetTableField.URL','URL'),
|
||||
@ -566,7 +566,7 @@ class File extends DataObject {
|
||||
if(!$name) $name = $this->Title;
|
||||
|
||||
// Fix illegal characters
|
||||
$filter = Object::create('FileNameFilter');
|
||||
$filter = FileNameFilter::create();
|
||||
$name = $filter->filter($name);
|
||||
|
||||
// We might have just turned it blank, so check again.
|
||||
|
@ -26,7 +26,7 @@
|
||||
*
|
||||
* See {@link URLSegmentFilter} for a more generic implementation.
|
||||
*/
|
||||
class FileNameFilter {
|
||||
class FileNameFilter extends Object {
|
||||
|
||||
/**
|
||||
* @var Boolean
|
||||
@ -100,7 +100,7 @@ class FileNameFilter {
|
||||
*/
|
||||
function getTransliterator() {
|
||||
if($this->transliterator === null && self::$default_use_transliterator) {
|
||||
$this->transliterator = Object::create('Transliterator');
|
||||
$this->transliterator = Transliterator::create();
|
||||
}
|
||||
return $this->transliterator;
|
||||
}
|
||||
|
@ -232,7 +232,7 @@ class Folder extends File {
|
||||
// $parentFolder = Folder::findOrMake("Uploads");
|
||||
|
||||
// Generate default filename
|
||||
$nameFilter = Object::create('FileNameFilter');
|
||||
$nameFilter = FileNameFilter::create();
|
||||
$file = $nameFilter->filter($tmpFile['name']);
|
||||
while($file[0] == '_' || $file[0] == '.') {
|
||||
$file = substr($file, 1);
|
||||
|
@ -131,7 +131,7 @@ class Upload extends Controller {
|
||||
}
|
||||
|
||||
// Generate default filename
|
||||
$nameFilter = Object::create('FileNameFilter');
|
||||
$nameFilter = FileNameFilter::create();
|
||||
$file = $nameFilter->filter($tmpFile['name']);
|
||||
$fileName = basename($file);
|
||||
|
||||
|
@ -816,7 +816,7 @@ class ComplexTableField_Popup extends Form {
|
||||
$actions = new FieldList();
|
||||
if(!$readonly) {
|
||||
$actions->push(
|
||||
Object::create('FormAction',
|
||||
FormAction::create(
|
||||
"saveComplexTableField",
|
||||
_t('CMSMain.SAVE', 'Save')
|
||||
)
|
||||
|
@ -112,7 +112,7 @@ class DateField extends TextField {
|
||||
|
||||
function FieldHolder() {
|
||||
// TODO Replace with properly extensible view helper system
|
||||
$d = Object::create('DateField_View_JQuery', $this);
|
||||
$d = DateField_View_JQuery::create($this);
|
||||
$d->onBeforeRender();
|
||||
$html = parent::FieldHolder();
|
||||
$html = $d->onAfterRender($html);
|
||||
@ -459,7 +459,7 @@ class DateField_Disabled extends DateField {
|
||||
* @package sapphire
|
||||
* @subpackage forms
|
||||
*/
|
||||
class DateField_View_JQuery {
|
||||
class DateField_View_JQuery extends Object {
|
||||
|
||||
protected $field;
|
||||
|
||||
|
@ -57,8 +57,8 @@ class DatetimeField extends FormField {
|
||||
function __construct($name, $title = null, $value = ""){
|
||||
$this->config = self::$default_config;
|
||||
|
||||
$this->dateField = Object::create('DateField', $name . '[date]', false);
|
||||
$this->timeField = Object::create('TimeField', $name . '[time]', false);
|
||||
$this->dateField = DateField::create($name . '[date]', false);
|
||||
$this->timeField = TimeField::create($name . '[time]', false);
|
||||
$this->timezoneField = new HiddenField($this->getName() . '[timezone]');
|
||||
|
||||
parent::__construct($name, $title, $value);
|
||||
|
@ -322,7 +322,7 @@ class HtmlEditorField_Toolbar extends RequestHandler {
|
||||
)
|
||||
),
|
||||
new FieldList(
|
||||
Object::create('ResetFormAction', 'remove', _t('HtmlEditorField.BUTTONREMOVELINK', 'Remove link'))
|
||||
ResetFormAction::create('remove', _t('HtmlEditorField.BUTTONREMOVELINK', 'Remove link'))
|
||||
->addExtraClass('ss-ui-action-destructive')
|
||||
->setUseButtonTag(true)
|
||||
,
|
||||
|
@ -407,7 +407,7 @@ class UploadField extends FileField {
|
||||
* @return UploadField_ItemHandler
|
||||
*/
|
||||
public function getItemHandler($itemID) {
|
||||
return Object::create('UploadField_ItemHandler', $this, $itemID);
|
||||
return UploadField_ItemHandler::create($this, $itemID);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -415,7 +415,7 @@ class UploadField extends FileField {
|
||||
* @return UploadField_ItemHandler
|
||||
*/
|
||||
public function handleSelect(SS_HTTPRequest $request) {
|
||||
return Object::create('UploadField_SelectHandler', $this, $this->folderName);
|
||||
return UploadField_SelectHandler::create($this, $this->folderName);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -98,7 +98,7 @@ class GridFieldDeleteAction implements GridField_ColumnProvider, GridField_Actio
|
||||
*/
|
||||
public function getColumnContent($gridField, $record, $columnName) {
|
||||
if($this->removeRelation) {
|
||||
$field = Object::create('GridField_FormAction', $gridField, 'UnlinkRelation'.$record->ID, false, "unlinkrelation", array('RecordID' => $record->ID))
|
||||
$field = GridField_FormAction::create($gridField, 'UnlinkRelation'.$record->ID, false, "unlinkrelation", array('RecordID' => $record->ID))
|
||||
->addExtraClass('gridfield-button-unlink')
|
||||
->setAttribute('title', _t('GridAction.UnlinkRelation', "Unlink"))
|
||||
->setAttribute('data-icon', 'chain--minus');
|
||||
@ -106,7 +106,7 @@ class GridFieldDeleteAction implements GridField_ColumnProvider, GridField_Actio
|
||||
if(!$record->canDelete()) {
|
||||
return;
|
||||
}
|
||||
$field = Object::create('GridField_FormAction', $gridField, 'DeleteRecord'.$record->ID, false, "deleterecord", array('RecordID' => $record->ID))
|
||||
$field = GridField_FormAction::create($gridField, 'DeleteRecord'.$record->ID, false, "deleterecord", array('RecordID' => $record->ID))
|
||||
->addExtraClass('gridfield-button-delete')
|
||||
->setAttribute('title', _t('GridAction.Delete', "Delete"))
|
||||
->setAttribute('data-icon', 'decline');
|
||||
|
@ -123,11 +123,11 @@ class GridFieldFilterHeader implements GridField_HTMLProvider, GridField_DataMan
|
||||
|
||||
$field = new FieldGroup(
|
||||
$field,
|
||||
Object::create('GridField_FormAction', $gridField, 'filter', false, 'filter', null)
|
||||
GridField_FormAction::create($gridField, 'filter', false, 'filter', null)
|
||||
->addExtraClass('ss-gridfield-button-filter')
|
||||
->setAttribute('title', _t('GridField.Filter', "Filter"))
|
||||
,
|
||||
Object::create('GridField_FormAction', $gridField, 'reset', false, 'reset', null)
|
||||
GridField_FormAction::create($gridField, 'reset', false, 'reset', null)
|
||||
->addExtraClass('ss-gridfield-button-reset')
|
||||
->setAttribute('title', _t('GridField.ResetFilter', "Reset"))
|
||||
);
|
||||
|
@ -153,7 +153,7 @@ class Image extends File {
|
||||
}
|
||||
|
||||
// Generate default filename
|
||||
$nameFilter = Object::create('FileNameFilter');
|
||||
$nameFilter = FileNameFilter::create();
|
||||
$file = $nameFilter->filter($tmpFile['name']);
|
||||
if(!$file) $file = "file.jpg";
|
||||
|
||||
|
@ -13,17 +13,13 @@
|
||||
* @package sapphire
|
||||
* @subpackage model
|
||||
*/
|
||||
class Transliterator {
|
||||
class Transliterator extends Object {
|
||||
/**
|
||||
* Allow the use of iconv() to perform transliteration. Set to false to disable.
|
||||
* Even if this variable is true, iconv() won't be used if it's not installed.
|
||||
*/
|
||||
static $use_iconv = false;
|
||||
|
||||
function __construct() {
|
||||
// A constructor is necessary for Object::create() to work
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Convert the given utf8 string to a safe ASCII source
|
||||
*/
|
||||
|
@ -14,12 +14,7 @@
|
||||
*
|
||||
* See {@link FileNameFilter} for similar implementation for filesystem-based URLs.
|
||||
*/
|
||||
class URLSegmentFilter {
|
||||
|
||||
/**
|
||||
* Necessary to support {@link Object::create()}
|
||||
*/
|
||||
function __construct() {}
|
||||
class URLSegmentFilter extends Object {
|
||||
|
||||
/**
|
||||
* @var Boolean
|
||||
@ -104,7 +99,7 @@ class URLSegmentFilter {
|
||||
*/
|
||||
function getTransliterator() {
|
||||
if($this->transliterator === null && self::$default_use_transliterator) {
|
||||
$this->transliterator = Object::create('Transliterator');
|
||||
$this->transliterator = Transliterator::create();
|
||||
}
|
||||
return $this->transliterator;
|
||||
}
|
||||
|
@ -66,8 +66,7 @@ class Group extends DataObject {
|
||||
new TabSet("Root",
|
||||
new Tab('Members', _t('SecurityAdmin.MEMBERS', 'Members'),
|
||||
new TextField("Title", $this->fieldLabel('Title')),
|
||||
$parentidfield = Object::create('DropdownField',
|
||||
'ParentID',
|
||||
$parentidfield = DropdownField::create( 'ParentID',
|
||||
$this->fieldLabel('Parent'),
|
||||
DataList::create('Group')->exclude('ID', $this->ID)->map('ID', 'Breadcrumbs')
|
||||
)->setEmptyString(' ')
|
||||
@ -100,7 +99,7 @@ class Group extends DataObject {
|
||||
$config->getComponentByType('GridFieldAddExistingAutocompleter')
|
||||
->setResultsFormat('$Title ($Email)')->setSearchFields(array('FirstName', 'Surname', 'Email'));
|
||||
$config->getComponentByType('GridFieldDetailForm')->setValidator(new Member_Validator());
|
||||
$memberList = Object::create('GridField', 'Members',false, $this->Members(), $config)->addExtraClass('members_grid');
|
||||
$memberList = GridField::create('Members',false, $this->Members(), $config)->addExtraClass('members_grid');
|
||||
// @todo Implement permission checking on GridField
|
||||
//$memberList->setPermissions(array('edit', 'delete', 'export', 'add', 'inlineadd'));
|
||||
$fields->addFieldToTab('Root.Members', $memberList);
|
||||
@ -164,7 +163,7 @@ class Group extends DataObject {
|
||||
$inheritedRoleIDs = array();
|
||||
}
|
||||
|
||||
$rolesField = Object::create('ListboxField', 'Roles', false, $allRoles->map()->toArray())
|
||||
$rolesField = ListboxField::create('Roles', false, $allRoles->map()->toArray())
|
||||
->setMultiple(true)
|
||||
->setDefaultItems($groupRoleIDs)
|
||||
->setAttribute('data-placeholder', _t('Group.AddRole', 'Add a role for this group'))
|
||||
|
@ -151,7 +151,7 @@ class Member extends DataObject implements TemplateGlobalProvider {
|
||||
if(!$admins) {
|
||||
// Leave 'Email' and 'Password' are not set to avoid creating
|
||||
// persistent logins in the database. See Security::setDefaultAdmin().
|
||||
$admin = Object::create('Member');
|
||||
$admin = Member::create();
|
||||
$admin->FirstName = _t('Member.DefaultAdminFirstname', 'Default Admin');
|
||||
$admin->write();
|
||||
$admin->Groups()->add($adminGroup);
|
||||
@ -480,13 +480,13 @@ class Member extends DataObject implements TemplateGlobalProvider {
|
||||
function sendInfo($type = 'signup', $data = null) {
|
||||
switch($type) {
|
||||
case "signup":
|
||||
$e = Object::create('Member_SignupEmail');
|
||||
$e = Member_SignupEmail::create();
|
||||
break;
|
||||
case "changePassword":
|
||||
$e = Object::create('Member_ChangePasswordEmail');
|
||||
$e = Member_ChangePasswordEmail::create();
|
||||
break;
|
||||
case "forgotPassword":
|
||||
$e = Object::create('Member_ForgotPasswordEmail');
|
||||
$e = Member_ForgotPasswordEmail::create();
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1134,7 +1134,7 @@ class Member extends DataObject implements TemplateGlobalProvider {
|
||||
$groupsMap = DataList::create('Group')->map('ID', 'Breadcrumbs')->toArray();
|
||||
asort($groupsMap);
|
||||
$fields->addFieldToTab('Root.Main',
|
||||
Object::create('ListboxField', 'DirectGroups', singleton('Group')->i18n_plural_name())
|
||||
ListboxField::create('DirectGroups', singleton('Group')->i18n_plural_name())
|
||||
->setMultiple(true)->setSource($groupsMap)
|
||||
);
|
||||
|
||||
|
@ -448,8 +448,7 @@ class Security extends Controller {
|
||||
* @return Form Returns the lost password form
|
||||
*/
|
||||
public function LostPasswordForm() {
|
||||
return Object::create('MemberLoginForm',
|
||||
$this,
|
||||
return MemberLoginForm::create( $this,
|
||||
'LostPasswordForm',
|
||||
new FieldList(
|
||||
new EmailField('Email', _t('Member.EMAIL', 'Email'))
|
||||
|
@ -113,7 +113,7 @@ class ObjectTest extends SapphireTest {
|
||||
* Tests that {@link Object::create()} correctly passes all arguments to the new object
|
||||
*/
|
||||
public function testCreateWithArgs() {
|
||||
$createdObj = Object::create('ObjectTest_CreateTest', 'arg1', 'arg2', array(), null, 'arg5');
|
||||
$createdObj = ObjectTest_CreateTest::create('arg1', 'arg2', array(), null, 'arg5');
|
||||
$this->assertEquals($createdObj->constructArguments, array('arg1', 'arg2', array(), null, 'arg5'));
|
||||
|
||||
$strongObj = Object::strong_create('ObjectTest_CreateTest', 'arg1', 'arg2', array(), null, 'arg5');
|
||||
@ -129,18 +129,18 @@ class ObjectTest extends SapphireTest {
|
||||
* Tests that {@link Object::useCustomClass()} correnctly replaces normal and strong objects
|
||||
*/
|
||||
public function testUseCustomClass() {
|
||||
$obj1 = Object::create('ObjectTest_CreateTest');
|
||||
$obj1 = ObjectTest_CreateTest::create();
|
||||
$this->assertTrue($obj1 instanceof ObjectTest_CreateTest);
|
||||
|
||||
Object::useCustomClass('ObjectTest_CreateTest', 'ObjectTest_CreateTest2');
|
||||
$obj2 = Object::create('ObjectTest_CreateTest');
|
||||
$obj2 = ObjectTest_CreateTest::create();
|
||||
$this->assertTrue($obj2 instanceof ObjectTest_CreateTest2);
|
||||
|
||||
$obj2_2 = Object::strong_create('ObjectTest_CreateTest');
|
||||
$this->assertTrue($obj2_2 instanceof ObjectTest_CreateTest);
|
||||
|
||||
Object::useCustomClass('ObjectTest_CreateTest', 'ObjectTest_CreateTest3', true);
|
||||
$obj3 = Object::create('ObjectTest_CreateTest');
|
||||
$obj3 = ObjectTest_CreateTest::create();
|
||||
$this->assertTrue($obj3 instanceof ObjectTest_CreateTest3);
|
||||
|
||||
$obj3_2 = Object::strong_create('ObjectTest_CreateTest');
|
||||
@ -269,12 +269,12 @@ class ObjectTest extends SapphireTest {
|
||||
}
|
||||
|
||||
public function testParentClass() {
|
||||
$this->assertEquals(Object::create('ObjectTest_MyObject')->parentClass(), 'Object');
|
||||
$this->assertEquals(ObjectTest_MyObject::create()->parentClass(), 'Object');
|
||||
}
|
||||
|
||||
public function testIsA() {
|
||||
$this->assertTrue(Object::create('ObjectTest_MyObject') instanceof Object);
|
||||
$this->assertTrue(Object::create('ObjectTest_MyObject') instanceof ObjectTest_MyObject);
|
||||
$this->assertTrue(ObjectTest_MyObject::create() instanceof Object);
|
||||
$this->assertTrue(ObjectTest_MyObject::create() instanceof ObjectTest_MyObject);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -144,7 +144,7 @@ class GridFieldDetailFormTest_Person extends DataObject implements TestOnly {
|
||||
$fields = parent::getCMSFields($params);
|
||||
// TODO No longer necessary once FormScaffolder uses GridField
|
||||
$fields->replaceField('Categories',
|
||||
Object::create('GridField', 'Categories', 'Categories',
|
||||
GridField::create('Categories', 'Categories',
|
||||
$this->Categories(),
|
||||
GridFieldConfig_RelationEditor::create()
|
||||
)
|
||||
@ -166,7 +166,7 @@ class GridFieldDetailFormTest_PeopleGroup extends DataObject implements TestOnly
|
||||
$fields = parent::getCMSFields($params);
|
||||
// TODO No longer necessary once FormScaffolder uses GridField
|
||||
$fields->replaceField('People',
|
||||
Object::create('GridField', 'People', 'People',
|
||||
GridField::create('People', 'People',
|
||||
$this->People(),
|
||||
GridFieldConfig_RelationEditor::create()
|
||||
)
|
||||
@ -188,7 +188,7 @@ class GridFieldDetailFormTest_Category extends DataObject implements TestOnly {
|
||||
$fields = parent::getCMSFields($params);
|
||||
// TODO No longer necessary once FormScaffolder uses GridField
|
||||
$fields->replaceField('People',
|
||||
Object::create('GridField', 'People', 'People',
|
||||
GridField::create('People', 'People',
|
||||
$this->People(),
|
||||
GridFieldConfig_RelationEditor::create()
|
||||
)
|
||||
|
@ -717,7 +717,7 @@ class ViewableData_Debugger extends ViewableData {
|
||||
|
||||
// check for an extra attached data
|
||||
if($this->object->hasMethod('data') && $this->object->data() != $this->object) {
|
||||
$debug .= Object::create('ViewableData_Debugger', $this->object->data())->forTemplate();
|
||||
$debug .= ViewableData_Debugger::create($this->object->data())->forTemplate();
|
||||
}
|
||||
|
||||
return $debug;
|
||||
|
Loading…
x
Reference in New Issue
Block a user