mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +02:00
ValidationException support in CMS "Settings" UI
This commit is contained in:
parent
bd5f631af6
commit
ec41cb38ce
@ -77,7 +77,13 @@ class CMSSettingsController extends LeftAndMain {
|
|||||||
public function save_siteconfig($data, $form) {
|
public function save_siteconfig($data, $form) {
|
||||||
$siteConfig = SiteConfig::current_site_config();
|
$siteConfig = SiteConfig::current_site_config();
|
||||||
$form->saveInto($siteConfig);
|
$form->saveInto($siteConfig);
|
||||||
$siteConfig->write();
|
|
||||||
|
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.')));
|
$this->response->addHeader('X-Status', rawurlencode(_t('LeftAndMain.SAVEDUP', 'Saved.')));
|
||||||
return $this->getResponseNegotiator()->respond($this->request);
|
return $this->getResponseNegotiator()->respond($this->request);
|
||||||
|
Loading…
Reference in New Issue
Block a user