Merge pull request #1459 from open-sausages/pulls/4.0/add-to-campaign

Add 'Add to campaign' button to pages
This commit is contained in:
Damian Mooyman 2016-04-28 10:04:24 +12:00
commit f0b574b835
2 changed files with 16 additions and 0 deletions

View File

@ -1,4 +1,6 @@
<?php
use SilverStripe\Model\FieldType\DBHTMLText;
/**
* The main "content" area of the CMS.
*
@ -1191,6 +1193,18 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
return $this->getResponseNegotiator()->respond($this->getRequest());
}
/**
* Action handler for adding pages to a campaign
*
* @param array $data
* @param Form $form
* @return DBHTMLText|SS_HTTPResponse
*/
public function addtocampaign($data, $form) {
$handler = AddToCampaignHandler::create($form, $data);
return $handler->handle();
}
/**
* Batch Actions Handler
*/

View File

@ -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