Capability to add any Versioned object to a campaign easily for CMS Admins


Repository: https://github.com/webbuilders-group/silverstripe-add-to-campaigns

Packagist: http://packagist.org/packages/webbuilders-group/silverstripe-add-to-campaigns

Issues: https://github.com/webbuilders-group/silverstripe-add-to-campaigns/issues

Authors: Ed Chipman

2 0 6.1K


Readme

Add to Campaigns

Capability to add any Versioned object to a campaign easily for CMS Admins via an "Add to Campaign" button in the CMS just like pages.

Maintainer Contact

Requirements

  • SilverStripe Campaign Admin 1.2+ | 2.0+

Installation

composer require webbuilders-group/silverstripe-add-to-campaigns

Usage

By default all SilverStripe\Forms\GridField\GridFieldDetailForm_ItemRequest instances will get an extension that will automatically configure the GridFieldDetailForm_ItemRequest edit form for the "Add to Campaign" functionality for all allowed classes. To add a class to the allowed support in your config.yml you must add the below. The DataObject must include the SilverStripe\Versioned\Versioned extension as well.

WebbuildersGroup\AddToCampaigns\Control\Admin\AddToCampaignController:
  campaignable_classes:
    - 'Full\DataObject\ClassName\Including\Namespace'

If you have not modified your GridFieldDetailForm_ItemRequest actions from the default GridFieldDetailForm_ItemRequest::getFormActions() the "Add to Campaign" button should be automatically be added to all allowed classes. If you have you can add the following to where ever you are setting up your form actions for your DataObject in your GridFieldDetailForm_ItemRequest extension.

use SilverStripe\CampaignAdmin\AddToCampaignHandler_FormAction;

/** ... **/

if (($myDataObject->isPublished() || $myDataObject->isOnDraft()) && $myDataObject->canPublish()) {
    $moreOptions->push(
        AddToCampaignHandler_FormAction::create()
            ->removeExtraClass('btn-primary')
            ->addExtraClass('btn-secondary')
    );
}

Versions

dev-master
2019-48-8 2458612: UTC
BSD-3-Clause

Install composer require webbuilders-group/silverstripe-add-to-campaigns dev-master

Manual Install: Download

Requires
  • silverstripe/campaign-admin: ~1.2
dev-dependabot/npm_and_yarn/webpack-5.94.0
2024-27-17 2460571: UTC
BSD-3-Clause

Install composer require webbuilders-group/silverstripe-add-to-campaigns dev-dependabot/npm_and_yarn/webpack-5.94.0

Manual Install: Download

Requires
  • silverstripe/campaign-admin: ~1.2|~2.0
dev-dependabot/npm_and_yarn/babel/traverse-7.23.2
2023-29-20 2460238: UTC
BSD-3-Clause

Install composer require webbuilders-group/silverstripe-add-to-campaigns dev-dependabot/npm_and_yarn/babel/traverse-7.23.2

Manual Install: Download

Requires
  • silverstripe/campaign-admin: ~1.2|~2.0
1.1.0
2023-28-28 2460154: UTC
BSD-3-Clause

Install composer require webbuilders-group/silverstripe-add-to-campaigns 1.1.0

Manual Install: Download

Requires
  • silverstripe/campaign-admin: ~1.2|~2.0
1.0.0
2019-37-23 2458597: UTC
BSD-3-Clause

Install composer require webbuilders-group/silverstripe-add-to-campaigns 1.0.0

Manual Install: Download

Requires
  • silverstripe/campaign-admin: ~1.2