MINOR Using late static binding instead of Object::create() calls

This commit is contained in:
Ingo Schommer 2012-04-04 16:59:22 +02:00
parent 070c9c22aa
commit de573e087d
8 changed files with 16 additions and 16 deletions

View File

@ -211,8 +211,8 @@ JS
// List view
$fields->addFieldsToTab('Root.ListView', array(
$actionsComposite = Object::create('CompositeField',
Object::create('CompositeField',
$actionsComposite = CompositeField::create(
CompositeField::create(
$uploadBtn,
$addFolderBtn,
$syncButton //TODO: add this into a batch actions menu as in https://github.com/silverstripe/silverstripe-design/raw/master/Design/ss3-ui_files-manager-list-view.jpg
@ -311,7 +311,7 @@ JS
$fields = $context->getSearchFields();
$actions = new FieldList(
Object::create('ResetFormAction', 'clear', _t('CMSMain_left.ss.CLEAR', 'Clear'))
ResetFormAction::create('clear', _t('CMSMain_left.ss.CLEAR', 'Clear'))
->addExtraClass('ss-ui-action-minor'),
FormAction::create('doSearch', _t('CMSMain_left.ss.SEARCH', 'Search'))
);

View File

@ -57,7 +57,7 @@ class CMSFileAddController extends LeftAndMain {
$folder = $this->currentPage();
$uploadField = Object::create('UploadField', 'AssetUploadField', '');
$uploadField = UploadField::create('AssetUploadField', '');
$uploadField->setConfig('previewMaxWidth', 40);
$uploadField->setConfig('previewMaxHeight', 30);
$uploadField->addExtraClass('ss-assetuploadfield');

View File

@ -200,7 +200,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
$dateTo->setConfig('showcalendar', true);
$actions = new FieldList(
Object::create('ResetFormAction', 'clear', _t('CMSMain_left.ss.CLEAR', 'Clear'))
ResetFormAction::create('clear', _t('CMSMain_left.ss.CLEAR', 'Clear'))
->addExtraClass('ss-ui-action-minor'),
FormAction::create('doSearch', _t('CMSMain_left.ss.SEARCH', 'Search'))
);

View File

@ -376,7 +376,7 @@ HTML;
} else {
if($date = Versioned::current_archived_date()) {
Requirements::css(CMS_DIR . '/css/SilverStripeNavigator.css');
$dateObj = Object::create('Datetime', $date, null);
$dateObj = Datetime::create($date, null);
// $dateObj->setVal($date);
return "<div id=\"SilverStripeNavigatorMessage\">". _t('ContentController.ARCHIVEDSITEFROM') ."<br>" . $dateObj->Nice() . "</div>";
}

View File

@ -299,7 +299,7 @@ class SilverStripeNavigatorItem_ArchiveLink extends SilverStripeNavigatorItem {
function getMessage() {
if($date = Versioned::current_archived_date()) {
$dateObj = Object::create('Datetime');
$dateObj = Datetime::create();
$dateObj->setValue($date);
return "<div id=\"SilverStripeNavigatorMessage\" title=\"". _t('ContentControl.NOTEWONTBESHOWN', 'Note: this message will not be shown to your visitors') ."\">". _t('ContentController.ARCHIVEDSITEFROM', 'Archived site from') ."<br>" . $dateObj->Nice() . "</div>";
}

View File

@ -56,13 +56,13 @@ class SiteConfig extends DataObject implements PermissionProvider {
),
$tabAccess = new Tab('Access',
$viewersOptionsField = new OptionsetField("CanViewType", _t('SiteConfig.VIEWHEADER', "Who can view pages on this site?")),
$viewerGroupsField = Object::create('ListboxField', "ViewerGroups", _t('SiteTree.VIEWERGROUPS', "Viewer Groups"))
$viewerGroupsField = ListboxField::create("ViewerGroups", _t('SiteTree.VIEWERGROUPS', "Viewer Groups"))
->setMultiple(true)->setSource($groupsMap),
$editorsOptionsField = new OptionsetField("CanEditType", _t('SiteConfig.EDITHEADER', "Who can edit pages on this site?")),
$editorGroupsField = Object::create('ListboxField', "EditorGroups", _t('SiteTree.EDITORGROUPS', "Editor Groups"))
$editorGroupsField = ListboxField::create("EditorGroups", _t('SiteTree.EDITORGROUPS', "Editor Groups"))
->setMultiple(true)->setSource($groupsMap),
$topLevelCreatorsOptionsField = new OptionsetField("CanCreateTopLevelType", _t('SiteConfig.TOPLEVELCREATE', "Who can create pages in the root of the site?")),
$topLevelCreatorsGroupsField = Object::create('ListboxField', "CreateTopLevelGroups", _t('SiteTree.TOPLEVELCREATORGROUPS', "Top level creators"))
$topLevelCreatorsGroupsField = ListboxField::create("CreateTopLevelGroups", _t('SiteTree.TOPLEVELCREATORGROUPS', "Top level creators"))
->setMultiple(true)->setSource($groupsMap)
)
)

View File

@ -1374,7 +1374,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
if((!$this->URLSegment || $this->URLSegment == 'new-page') && $this->Title) {
$this->URLSegment = $this->generateURLSegment($this->Title);
} else if($this->isChanged('URLSegment')) {
$filter = Object::create('URLSegmentFilter');
$filter = URLSegmentFilter::create();
$this->URLSegment = $filter->filter($this->URLSegment);
// If after sanitising there is no URLSegment, give it a reasonable default
if(!$this->URLSegment) $this->URLSegment = "page-$this->ID";
@ -1583,7 +1583,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
* @return string Generated url segment
*/
function generateURLSegment($title){
$filter = Object::create('URLSegmentFilter');
$filter = URLSegmentFilter::create();
$t = $filter->filter($title);
// Fallback to generic page name if path is empty (= no valid, convertable characters)
@ -1906,13 +1906,13 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
"CanViewType",
_t('SiteTree.ACCESSHEADER', "Who can view this page?")
),
$viewerGroupsField = Object::create('ListboxField', "ViewerGroups", _t('SiteTree.VIEWERGROUPS', "Viewer Groups"))
$viewerGroupsField = ListboxField::create("ViewerGroups", _t('SiteTree.VIEWERGROUPS', "Viewer Groups"))
->setMultiple(true)->setSource($groupsMap),
$editorsOptionsField = new OptionsetField(
"CanEditType",
_t('SiteTree.EDITHEADER', "Who can edit this page?")
),
$editorGroupsField = Object::create('ListboxField', "EditorGroups", _t('SiteTree.EDITORGROUPS', "Editor Groups"))
$editorGroupsField = ListboxField::create("EditorGroups", _t('SiteTree.EDITORGROUPS', "Editor Groups"))
->setMultiple(true)->setSource($groupsMap)
)
)
@ -2022,7 +2022,7 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
* @return FieldList The available actions for this page.
*/
function getCMSActions() {
$minorActions = Object::create('CompositeField')->setTag('fieldset')->addExtraClass('ss-ui-buttonset');
$minorActions = CompositeField::create()->setTag('fieldset')->addExtraClass('ss-ui-buttonset');
$actions = new FieldList($minorActions);
// "readonly"/viewing version that isn't the current version of the record

View File

@ -106,7 +106,7 @@ in the other stage:<br />
$orphan->ID,
$orphan->Title,
$orphan->ID,
DBField::create('Date', $orphan->LastEdited)->Nice(),
Date::create($orphan->LastEdited)->Nice(),
($latestAuthor) ? $latestAuthor->Title : 'unknown',
($liveRecord) ? 'is published' : 'not published'
);