@@ -1,7 +1,5 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -use SaltedHerring\Debugger as Debugger; |
|
4 | - |
|
5 | 3 | class VersionedForm extends GridFieldDetailForm { |
6 | 4 | |
7 | 5 | } |
@@ -7,47 +7,47 @@ |
||
7 | 7 | } |
8 | 8 | |
9 | 9 | class VersionedForm_ItemRequest extends GridFieldDetailForm_ItemRequest { |
10 | - private static $allowed_actions = array( |
|
11 | - 'edit', |
|
12 | - 'view', |
|
13 | - 'ItemEditForm', |
|
14 | - 'doPublish', |
|
15 | - 'doUnpublish' |
|
16 | - ); |
|
10 | + private static $allowed_actions = array( |
|
11 | + 'edit', |
|
12 | + 'view', |
|
13 | + 'ItemEditForm', |
|
14 | + 'doPublish', |
|
15 | + 'doUnpublish' |
|
16 | + ); |
|
17 | 17 | |
18 | - public function ItemEditForm() { |
|
19 | - $form = parent::ItemEditForm(); |
|
20 | - if ($form instanceof Form) { |
|
21 | - $actions = $form->Actions(); |
|
22 | - $record = $this->record; |
|
23 | - $actions->insertBefore('action_doDelete', $btnPublish = FormAction::create('doPublish','Save & Publish')); |
|
24 | - $btnPublish->addExtraClass('ss-ui-action-constructive'); |
|
25 | - if (!empty($record->ID)) { |
|
26 | - if ($record->isPublished()) { |
|
27 | - $actions->removeByName('action_doDelete'); |
|
28 | - $actions->push(FormAction::create('doUnpublish', 'Unpublish')->addExtraClass('ss-ui-action-destructive')); |
|
29 | - } |
|
30 | - } |
|
18 | + public function ItemEditForm() { |
|
19 | + $form = parent::ItemEditForm(); |
|
20 | + if ($form instanceof Form) { |
|
21 | + $actions = $form->Actions(); |
|
22 | + $record = $this->record; |
|
23 | + $actions->insertBefore('action_doDelete', $btnPublish = FormAction::create('doPublish','Save & Publish')); |
|
24 | + $btnPublish->addExtraClass('ss-ui-action-constructive'); |
|
25 | + if (!empty($record->ID)) { |
|
26 | + if ($record->isPublished()) { |
|
27 | + $actions->removeByName('action_doDelete'); |
|
28 | + $actions->push(FormAction::create('doUnpublish', 'Unpublish')->addExtraClass('ss-ui-action-destructive')); |
|
29 | + } |
|
30 | + } |
|
31 | 31 | |
32 | - $form->setActions($actions); |
|
33 | - } |
|
34 | - return $form; |
|
35 | - } |
|
32 | + $form->setActions($actions); |
|
33 | + } |
|
34 | + return $form; |
|
35 | + } |
|
36 | 36 | |
37 | - public function doUnpublish($data, $form) { |
|
38 | - $this->record->deleteFromStage('Live'); |
|
39 | - $controller = Controller::curr(); |
|
40 | - $form->sessionMessage('Block unpublished', 'good', false); |
|
41 | - return $this->edit($controller->getRequest()); |
|
42 | - } |
|
37 | + public function doUnpublish($data, $form) { |
|
38 | + $this->record->deleteFromStage('Live'); |
|
39 | + $controller = Controller::curr(); |
|
40 | + $form->sessionMessage('Block unpublished', 'good', false); |
|
41 | + return $this->edit($controller->getRequest()); |
|
42 | + } |
|
43 | 43 | |
44 | - public function doPublish($data, $form) { |
|
45 | - $form->saveInto($this->record); |
|
46 | - $this->record->write(); |
|
47 | - $this->record->byPass = true; |
|
48 | - $this->record->doPublish(); |
|
49 | - $form->sessionMessage('Block published', 'good', false); |
|
50 | - $controller = Controller::curr(); |
|
51 | - return $this->edit($controller->getRequest()); |
|
52 | - } |
|
44 | + public function doPublish($data, $form) { |
|
45 | + $form->saveInto($this->record); |
|
46 | + $this->record->write(); |
|
47 | + $this->record->byPass = true; |
|
48 | + $this->record->doPublish(); |
|
49 | + $form->sessionMessage('Block published', 'good', false); |
|
50 | + $controller = Controller::curr(); |
|
51 | + return $this->edit($controller->getRequest()); |
|
52 | + } |
|
53 | 53 | } |
54 | 54 | \ No newline at end of file |
@@ -20,7 +20,7 @@ |
||
20 | 20 | if ($form instanceof Form) { |
21 | 21 | $actions = $form->Actions(); |
22 | 22 | $record = $this->record; |
23 | - $actions->insertBefore('action_doDelete', $btnPublish = FormAction::create('doPublish','Save & Publish')); |
|
23 | + $actions->insertBefore('action_doDelete', $btnPublish = FormAction::create('doPublish', 'Save & Publish')); |
|
24 | 24 | $btnPublish->addExtraClass('ss-ui-action-constructive'); |
25 | 25 | if (!empty($record->ID)) { |
26 | 26 | if ($record->isPublished()) { |