mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 06:05:56 +00:00
FIX for #586 and possible fix for #736 and relates to #2449: Don't perform validation upon deletion, since it isn't necessary. Cleaned up type hint.
This commit is contained in:
parent
d8915115f8
commit
75dc391df9
@ -593,7 +593,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
||||
/**
|
||||
* @param int $id
|
||||
* @param FieldList $fields
|
||||
* @return Form
|
||||
* @return CMSForm
|
||||
*/
|
||||
public function getEditForm($id = null, $fields = null) {
|
||||
|
||||
@ -676,7 +676,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
||||
// if($form->Fields()->hasTabset()) $form->Fields()->findOrMakeTab('Root')->setTemplate('CMSTabSet');
|
||||
$form->setAttribute('data-pjax-fragment', 'CurrentForm');
|
||||
// Set validation exemptions for specific actions
|
||||
$form->setValidationExemptActions(array('restore', 'revert', 'deletefromlive', 'rollback'));
|
||||
$form->setValidationExemptActions(array('restore', 'revert', 'deletefromlive', 'delete', 'unpublish', 'rollback'));
|
||||
|
||||
// Announce the capability so the frontend can decide whether to allow preview or not.
|
||||
if(in_array('CMSPreviewable', class_implements($record))) {
|
||||
|
@ -465,6 +465,25 @@ class CMSMainTest extends FunctionalTest {
|
||||
$pages->column('Title')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Testing retrieval and type of CMS edit form.
|
||||
*/
|
||||
public function testGetEditForm() {
|
||||
// Login is required prior to accessing a CMS form.
|
||||
$this->loginWithPermission('ADMIN');
|
||||
|
||||
// Get a associated with a fixture page.
|
||||
$page = $this->objFromFixture('Page', 'page1');
|
||||
$controller = new CMSMain();
|
||||
$form = $controller->getEditForm($page->ID);
|
||||
$this->assertInstanceOf("CMSForm", $form);
|
||||
|
||||
// Ensure that the form will not "validate" on delete or "unpublish" actions.
|
||||
$exemptActions = $form->getValidationExemptActions();
|
||||
$this->assertContains("delete", $exemptActions);
|
||||
$this->assertContains("unpublish", $exemptActions);
|
||||
}
|
||||
}
|
||||
|
||||
class CMSMainTest_ClassA extends Page implements TestOnly {
|
||||
|
Loading…
x
Reference in New Issue
Block a user