Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Only require CMSMain.EditForm if CMS_DIR is defined
  • Loading branch information
jovenden committed Oct 13, 2017
1 parent 4e352fd commit dbc5435
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions code/controller/SiteConfigLeftAndMain.php
Expand Up @@ -40,7 +40,9 @@ class SiteConfigLeftAndMain extends LeftAndMain {
*/
public function init() {
parent::init();
Requirements::javascript(CMS_DIR . '/javascript/CMSMain.EditForm.js');
if (defined('CMS_DIR')) {
Requirements::javascript(CMS_DIR . '/javascript/CMSMain.EditForm.js');
}
}

/**
Expand Down Expand Up @@ -69,7 +71,7 @@ public function getEditForm($id = null, $fields = null) {
}

$actions = $siteConfig->getCMSActions();
$form = CMSForm::create(
$form = CMSForm::create(
$this, 'EditForm', $fields, $actions, $validator
)->setHTMLID('Form_EditForm');
$form->setResponseNegotiator($this->getResponseNegotiator());
Expand Down Expand Up @@ -102,26 +104,26 @@ public function getSilverStripeNavigator() {
/**
* Save the current sites {@link SiteConfig} into the database.
*
* @param array $data
* @param Form $form
* @param array $data
* @param Form $form
* @return String
*/
public function save_siteconfig($data, $form) {
$siteConfig = SiteConfig::current_site_config();
$form->saveInto($siteConfig);

try {
$siteConfig->write();
} catch(ValidationException $ex) {
$form->sessionMessage($ex->getResult()->message(), 'bad');
return $this->getResponseNegotiator()->respond($this->request);
}

$this->response->addHeader('X-Status', rawurlencode(_t('LeftAndMain.SAVEDUP', 'Saved.')));

return $form->forTemplate();
}


public function Breadcrumbs($unlinked = false) {
$defaultTitle = self::menu_title_for_class(get_class($this));
Expand Down

0 comments on commit dbc5435

Please sign in to comment.