Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

  • Loading branch information...
commit de573e087d4a9d05692a0f665e836f489ccaf9a5 1 parent 070c9c2
@chillu chillu authored
View
6 code/controllers/AssetAdmin.php
@@ -211,8 +211,8 @@ public function getEditForm($id = null, $fields = null) {
// 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 @@ public function SearchForm() {
$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
2  code/controllers/CMSFileAddController.php
@@ -57,7 +57,7 @@ public function getEditForm($id = null, $fields = null) {
$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
2  code/controllers/CMSMain.php
@@ -200,7 +200,7 @@ function SearchForm() {
$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
2  code/controllers/ContentController.php
@@ -376,7 +376,7 @@ public function SilverStripeNavigator() {
} 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
2  code/controllers/SilverStripeNavigator.php
@@ -299,7 +299,7 @@ function getHTML() {
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
6 code/model/SiteConfig.php
@@ -56,13 +56,13 @@ function getCMSFields($params = null) {
),
$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
10 code/model/SiteTree.php
@@ -1374,7 +1374,7 @@ protected function onBeforeWrite() {
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 @@ public function validURLSegment() {
* @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 @@ function getSettingsFields() {
"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 @@ function fieldLabels($includerelations = true) {
* @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
2  tasks/RemoveOrphanedPagesTask.php
@@ -106,7 +106,7 @@ function Form() {
$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'
);

0 comments on commit de573e0

Please sign in to comment.
Something went wrong with that request. Please try again.