mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 06:05:56 +00:00
ENHANCEMENT: Add 'Cancel' button to 'Add Page' form
This commit is contained in:
parent
e444b359ec
commit
95d9257b1b
@ -10,6 +10,7 @@ class CMSPageAddController extends CMSPageEditController {
|
|||||||
private static $allowed_actions = array(
|
private static $allowed_actions = array(
|
||||||
'AddForm',
|
'AddForm',
|
||||||
'doAdd',
|
'doAdd',
|
||||||
|
'doCancel'
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -108,9 +109,11 @@ class CMSPageAddController extends CMSPageEditController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$actions = new FieldList(
|
$actions = new FieldList(
|
||||||
// $resetAction = new ResetFormAction('doCancel', _t('CMSMain.Cancel', 'Cancel')),
|
|
||||||
FormAction::create("doAdd", _t('CMSMain.Create',"Create"))
|
FormAction::create("doAdd", _t('CMSMain.Create',"Create"))
|
||||||
->addExtraClass('ss-ui-action-constructive')->setAttribute('data-icon', 'accept')
|
->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)
|
->setUseButtonTag(true)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -174,4 +177,8 @@ class CMSPageAddController extends CMSPageEditController {
|
|||||||
return $this->redirect(Controller::join_links(singleton('CMSPageEditController')->Link('show'), $record->ID));
|
return $this->redirect(Controller::join_links(singleton('CMSPageEditController')->Link('show'), $record->ID));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function doCancel($data, $form) {
|
||||||
|
return $this->redirect(singleton('CMSMain')->Link());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user