mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +02: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',
|
||||
'publishitems',
|
||||
'PublishItemsForm',
|
||||
'RootForm',
|
||||
'sidereport',
|
||||
'SideReportsForm',
|
||||
'submit',
|
||||
@ -525,41 +524,12 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
||||
$this->extend('updateEditForm', $form);
|
||||
|
||||
return $form;
|
||||
} if ($id == 0 || $id == 'root') {
|
||||
return $this->RootForm();
|
||||
} else if($id) {
|
||||
return new Form($this, "EditForm", 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() {
|
||||
$id = parent::currentPageID();
|
||||
|
@ -6,8 +6,31 @@ class CMSSettingsController extends CMSMain {
|
||||
static $menu_priority = -1;
|
||||
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() {
|
||||
|
Loading…
Reference in New Issue
Block a user