From 69d7a3ae7deba2d7aabfb6eb481440ac65500e4f Mon Sep 17 00:00:00 2001 From: scott1702 Date: Thu, 17 Mar 2016 14:42:53 +1300 Subject: [PATCH] Add 'Add to campaign' button to pages --- code/controllers/CMSMain.php | 5 +++++ code/model/SiteTree.php | 2 ++ 2 files changed, 7 insertions(+) diff --git a/code/controllers/CMSMain.php b/code/controllers/CMSMain.php index 411c745a..c39db003 100644 --- a/code/controllers/CMSMain.php +++ b/code/controllers/CMSMain.php @@ -1191,6 +1191,11 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr return $this->getResponseNegotiator()->respond($this->getRequest()); } + public function addtocampaign($data, $form) { + $handler = new AddToCampaignHandler($form, $data); + return $handler->handle(); + } + /** * Batch Actions Handler */ diff --git a/code/model/SiteTree.php b/code/model/SiteTree.php index 695923a0..c0c753fe 100755 --- a/code/model/SiteTree.php +++ b/code/model/SiteTree.php @@ -2075,6 +2075,8 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid ) ); + $moreOptions->push(AddToCampaignHandler_FormAction::create()); + // "readonly"/viewing version that isn't the current version of the record $stageOrLiveRecord = Versioned::get_one_by_stage($this->class, Versioned::get_stage(), array( '"SiteTree"."ID"' => $this->ID