Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add to Campaign Button not Appearing #1

Open
dirtybirdnj opened this issue Jul 23, 2019 · 3 comments
Open

Add to Campaign Button not Appearing #1

dirtybirdnj opened this issue Jul 23, 2019 · 3 comments

Comments

@dirtybirdnj
Copy link

I have a DataObject that extends SilverStripe\CMS\Model\SiteTree and I can't get the extra three dots button to show up on the edit interface for the DataObject.

Here's my /app/_config/config.yml

WebbuildersGroup\AddToCampaigns\Control\Admin\AddToCampaignController:
  campaignable_classes:
    - 'ArticlePage'

The project I'm working on doesn't use namespacing, I'm thinking that might be the reason this isn't working?

There is no customization of the forms happening, I'm unsure of where to put the example code provided. Does this go into the Model files getCMSFields() function? Does it belong in the controller? I'm relatively new to SilverStripe so sorry if this is a dumb question.

use SilverStripe\CampaignAdmin\AddToCampaignHandler_FormAction;

/** ... **/

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

Here's a screenshot of what I see in the edit interface

Edit interface... no campaigns button

@UndefinedOffset UndefinedOffset added bug Something isn't working and removed bug Something isn't working labels Jul 23, 2019
@UndefinedOffset
Copy link
Member

When you inspect the form is there a add-to-campaign-supported attribute? And after you installed and updated your config have you flushed?

@dirtybirdnj
Copy link
Author

dirtybirdnj commented Jul 25, 2019

Here's the opening form tag from that page:

<form id="Form_ItemEditForm" action="admin/articles/ArticlePage/EditForm/field/ArticlePage/item/5537/ItemEditForm/" method="post" enctype="application/x-www-form-urlencoded" class="cms-content cms-edit-form center fill-height flexbox-area-grow cms-tabset ui-tabs ui-widget ui-widget-content ui-corner-all" data-pjax-fragment="CurrentForm Content" data-layout-type="border" autocomplete="off" style="min-width: 0px;">

What's the best way to determine if the module is being loaded / installed properly?

And after you installed and updated your config have you flushed?

Yes, many times. I always have a second tab open to dev/build?flush=all

Could it be because we are on SS version 4.4.1? We wanted to update to the newly announced 4.5.0 but noticed it wasn't officially released yet.

I tried downgrading to 4.3.4 which required bringing campaign-admin from 1.4 down to 1.3.4... sadly this didn't make a difference.

@UndefinedOffset
Copy link
Member

The client I actually built this for in running 4.4.1 :) and it was working there I don't think the lack of namespacing is the issue, it's possible though. You could try outputting the result of $yourobject->baseClass() and see if that matches what you put in your yaml config. Based on the lack of attributes either the WebbuildersGroup\AddToCampaigns\Extensions\CampaignableGridField::updateItemEditForm() method is not being called or the base class is not matching what is in your config. You could figure out the former by putting some kind of test statement in CampaignableGridField.php's updateItemEditForm method

There is no customization of the forms happening, I'm unsure of where to put the example code provided. Does this go into the Model files getCMSFields() function? Does it belong in the controller? I'm relatively new to SilverStripe so sorry if this is a dumb question.

This would go in the model's getCMSActions(), but so long as you haven't extended and replaced the actions the GridFieldDetailForm_ItemRequest builds you'll be fine ;).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants