Merge pull request #2382 from creative-commoners/pulls/4.4/remove-add-to-campaign-button

FIX Remove coupling from SiteTree to campaign admin module
This commit is contained in:
Guy Marriott 2019-02-04 22:20:35 +13:00 committed by GitHub
commit 97ee18d463
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 0 additions and 17 deletions

View File

@ -5,7 +5,6 @@ namespace SilverStripe\CMS\Model;
use Page;
use Psr\SimpleCache\CacheInterface;
use SilverStripe\Assets\Shortcodes\FileLinkTracking;
use SilverStripe\CampaignAdmin\AddToCampaignHandler_FormAction;
use SilverStripe\CMS\Controllers\CMSPageEditController;
use SilverStripe\CMS\Controllers\ContentController;
use SilverStripe\CMS\Controllers\ModelAsController;
@ -33,7 +32,6 @@ use SilverStripe\Forms\FormAction;
use SilverStripe\Forms\GridField\GridField;
use SilverStripe\Forms\GridField\GridFieldDataColumns;
use SilverStripe\Forms\GridField\GridFieldLazyLoader;
use SilverStripe\Forms\GridField\GridFieldSortableHeader;
use SilverStripe\Forms\HTMLEditor\HTMLEditorField;
use SilverStripe\Forms\LiteralField;
use SilverStripe\Forms\OptionsetField;
@ -2329,15 +2327,6 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi
)
);
// Add to campaign option if not-archived and has publish permission
if (($isPublished || $isOnDraft) && $canPublish) {
$moreOptions->push(
AddToCampaignHandler_FormAction::create()
->removeExtraClass('btn-primary')
->addExtraClass('btn-secondary')
);
}
// "readonly"/viewing version that isn't the current version of the record
/** @var SiteTree $stageRecord */
$stageRecord = Versioned::get_by_stage(static::class, Versioned::DRAFT)->byID($this->ID);

View File

@ -41,7 +41,6 @@ class SiteTreeActionsTest extends FunctionalTest
$page = Page::get()->byID($page->ID);
$actions = $page->getCMSActions();
$this->assertNull($actions->dataFieldByName('action_addtocampaign'));
$this->assertNull($actions->dataFieldByName('action_save'));
$this->assertNull($actions->dataFieldByName('action_publish'));
$this->assertNull($actions->dataFieldByName('action_unpublish'));
@ -96,7 +95,6 @@ class SiteTreeActionsTest extends FunctionalTest
$actions = $page->getCMSActions();
$this->assertNotNull($actions->dataFieldByName('action_addtocampaign'));
$this->assertNotNull($actions->dataFieldByName('action_save'));
$this->assertNotNull($actions->dataFieldByName('action_publish'));
$this->assertNotNull($actions->dataFieldByName('action_unpublish'));
@ -124,8 +122,6 @@ class SiteTreeActionsTest extends FunctionalTest
$actions = $page->getCMSActions();
// Theoretically allow deletions to be staged via add to campaign
$this->assertNotNull($actions->dataFieldByName('action_addtocampaign'));
$this->assertNull($actions->dataFieldByName('action_save'));
$this->assertNull($actions->dataFieldByName('action_publish'));
$this->assertNull($actions->dataFieldByName('action_unpublish'));
@ -152,7 +148,6 @@ class SiteTreeActionsTest extends FunctionalTest
$page = Page::get()->byID($page->ID);
$actions = $page->getCMSActions();
$this->assertNotNull($actions->dataFieldByName('action_addtocampaign'));
$this->assertNotNull($actions->dataFieldByName('action_save'));
$this->assertNotNull($actions->dataFieldByName('action_publish'));
$this->assertNotNull($actions->dataFieldByName('action_unpublish'));
@ -173,7 +168,6 @@ class SiteTreeActionsTest extends FunctionalTest
$version = DB::query('SELECT "Version" FROM "SiteTree_Versions" WHERE "Content" = \'test page first version\'')->value();
$old = Versioned::get_version('Page', $p->ID, $version);
$actions = $old->getCMSActions();
$this->assertNull($actions->dataFieldByName('action_addtocampaign'));
$this->assertNull($actions->dataFieldByName('action_save'));
$this->assertNull($actions->dataFieldByName('action_publish'));
$this->assertNull($actions->dataFieldByName('action_unpublish'));