From 95d9257b1b20070e4058eab037c6367c161141d7 Mon Sep 17 00:00:00 2001 From: Loz Calver Date: Thu, 4 Jul 2013 15:12:25 +0100 Subject: [PATCH] ENHANCEMENT: Add 'Cancel' button to 'Add Page' form --- code/controllers/CMSPageAddController.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/code/controllers/CMSPageAddController.php b/code/controllers/CMSPageAddController.php index 14564425..496052f4 100644 --- a/code/controllers/CMSPageAddController.php +++ b/code/controllers/CMSPageAddController.php @@ -10,6 +10,7 @@ class CMSPageAddController extends CMSPageEditController { private static $allowed_actions = array( 'AddForm', 'doAdd', + 'doCancel' ); /** @@ -108,9 +109,11 @@ class CMSPageAddController extends CMSPageEditController { } $actions = new FieldList( - // $resetAction = new ResetFormAction('doCancel', _t('CMSMain.Cancel', 'Cancel')), FormAction::create("doAdd", _t('CMSMain.Create',"Create")) ->addExtraClass('ss-ui-action-constructive')->setAttribute('data-icon', 'accept') + ->setUseButtonTag(true), + FormAction::create("doCancel", _t('CMSMain.Cancel',"Cancel")) + ->addExtraClass('ss-ui-action-destructive') ->setUseButtonTag(true) ); @@ -174,4 +177,8 @@ class CMSPageAddController extends CMSPageEditController { return $this->redirect(Controller::join_links(singleton('CMSPageEditController')->Link('show'), $record->ID)); } + public function doCancel($data, $form) { + return $this->redirect(singleton('CMSMain')->Link()); + } + }