mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 06:05:56 +00:00
MINOR Moved CMSMain->RootForm() to CMSSettingsController (same effect, but clearer structure)
This commit is contained in:
parent
c94308d21d
commit
79269a22ed
@ -38,7 +38,6 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
'publishall',
|
'publishall',
|
||||||
'publishitems',
|
'publishitems',
|
||||||
'PublishItemsForm',
|
'PublishItemsForm',
|
||||||
'RootForm',
|
|
||||||
'sidereport',
|
'sidereport',
|
||||||
'SideReportsForm',
|
'SideReportsForm',
|
||||||
'submit',
|
'submit',
|
||||||
@ -525,41 +524,12 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
$this->extend('updateEditForm', $form);
|
$this->extend('updateEditForm', $form);
|
||||||
|
|
||||||
return $form;
|
return $form;
|
||||||
} if ($id == 0 || $id == 'root') {
|
|
||||||
return $this->RootForm();
|
|
||||||
} else if($id) {
|
} else if($id) {
|
||||||
return new Form($this, "EditForm", new FieldList(
|
return new Form($this, "EditForm", new FieldList(
|
||||||
new LabelField('PageDoesntExistLabel',_t('CMSMain.PAGENOTEXISTS',"This page doesn't exist"))), new FieldList()
|
new LabelField('PageDoesntExistLabel',_t('CMSMain.PAGENOTEXISTS',"This page doesn't exist"))), new FieldList()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return Form
|
|
||||||
*/
|
|
||||||
function RootForm() {
|
|
||||||
$siteConfig = SiteConfig::current_site_config();
|
|
||||||
$fields = $siteConfig->getCMSFields();
|
|
||||||
|
|
||||||
$actions = $siteConfig->getCMSActions();
|
|
||||||
$form = new Form($this, 'RootForm', $fields, $actions);
|
|
||||||
$form->addExtraClass('root-form');
|
|
||||||
$form->addExtraClass('cms-edit-form');
|
|
||||||
// TODO Can't merge $FormAttributes in template at the moment
|
|
||||||
$form->addExtraClass('cms-content center ss-tabset');
|
|
||||||
if($form->Fields()->hasTabset()) $form->Fields()->findOrMakeTab('Root')->setTemplate('CMSTabSet');
|
|
||||||
$form->setHTMLID('Form_EditForm');
|
|
||||||
$form->loadDataFrom($siteConfig);
|
|
||||||
$form->setTemplate($this->getTemplatesWithSuffix('_EditForm'));
|
|
||||||
|
|
||||||
// Use <button> to allow full jQuery UI styling
|
|
||||||
$actions = $actions->dataFields();
|
|
||||||
if($actions) foreach($actions as $action) $action->setUseButtonTag(true);
|
|
||||||
|
|
||||||
$this->extend('updateEditForm', $form);
|
|
||||||
|
|
||||||
return $form;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function currentPageID() {
|
public function currentPageID() {
|
||||||
$id = parent::currentPageID();
|
$id = parent::currentPageID();
|
||||||
|
@ -6,8 +6,31 @@ class CMSSettingsController extends CMSMain {
|
|||||||
static $menu_priority = -1;
|
static $menu_priority = -1;
|
||||||
static $menu_title = 'Settings';
|
static $menu_title = 'Settings';
|
||||||
|
|
||||||
function getEditForm($id = null, $fields = null) {
|
/**
|
||||||
return $this->RootForm();
|
* @return Form
|
||||||
|
*/
|
||||||
|
function getEditForm($id = null) {
|
||||||
|
$siteConfig = SiteConfig::current_site_config();
|
||||||
|
$fields = $siteConfig->getCMSFields();
|
||||||
|
|
||||||
|
$actions = $siteConfig->getCMSActions();
|
||||||
|
$form = new Form($this, 'EditForm', $fields, $actions);
|
||||||
|
$form->addExtraClass('root-form');
|
||||||
|
$form->addExtraClass('cms-edit-form');
|
||||||
|
// TODO Can't merge $FormAttributes in template at the moment
|
||||||
|
$form->addExtraClass('cms-content center ss-tabset');
|
||||||
|
if($form->Fields()->hasTabset()) $form->Fields()->findOrMakeTab('Root')->setTemplate('CMSTabSet');
|
||||||
|
$form->setHTMLID('Form_EditForm');
|
||||||
|
$form->loadDataFrom($siteConfig);
|
||||||
|
$form->setTemplate($this->getTemplatesWithSuffix('_EditForm'));
|
||||||
|
|
||||||
|
// Use <button> to allow full jQuery UI styling
|
||||||
|
$actions = $actions->dataFields();
|
||||||
|
if($actions) foreach($actions as $action) $action->setUseButtonTag(true);
|
||||||
|
|
||||||
|
$this->extend('updateEditForm', $form);
|
||||||
|
|
||||||
|
return $form;
|
||||||
}
|
}
|
||||||
|
|
||||||
function PreviewLink() {
|
function PreviewLink() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user