Jump to:

5513 Posts in 1732 Topics by 1218 members

Customising the CMS

SilverStripe Forums » Customising the CMS » Remove Preview Button

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 494 Views
  • suntrop
    Avatar
    Community Member
    131 Posts

    Remove Preview Button Link to this post

    I want to remove (or at least hide) the Preview button on some of my pagetypes, because those pagetypes are only viewable within their parent pages. Thus the preview will fail and looks terrible at the front-end

    Found this, but doesn't worked:

    public function EditForm() {
          $form = parent::EditForm();
          $actions = $form->Actions();
          $actions->removeByName('Preview'); // remove save button from form
          return $form;
       }
       function getCMSActions(){
        $actions = parent::getCMSActions();
        $Action = new FormAction(
        "doAction",
        "Do something different"
        );
        $actions->push($Action);
        $actions->removeByName('Save');
        $actions->removeByName('Unpublish');
        $actions->removeByName('Publish');
        $actions->removeByName('Delete');
        $actions->removeByName('Preview');
        return $actions;
       }

  • Spambanjo
    Avatar
    Community Member
    15 Posts

    Re: Remove Preview Button Link to this post

    I also need a solution to this problem, did you ever find anything?

    I'm amazed there isn't a simple $allow_preview static for disabling it all together on certain page types.

  • suntrop
    Avatar
    Community Member
    131 Posts

    Re: Remove Preview Button Link to this post

    No, unfortunately I found nothing about it, but I stopped working with SS completely

    494 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.