How to add a new button to CMS

<%- if @topic_view.topic.tags.present? %>
<%= t 'js.tagging.tags' %>: <%- @topic_view.topic.tags.each do |t| %> <%= t %> <%- end %>
<% end %>

Silverstripe 4.5

Forgive me for flooding the forum I’m new to SIlverstripe. I’m again stuck with adding a new button to the admin CMS. I’ve tried various approaches and can’t believe why this is so complicated.

I tried this with no luck.

I simply want to add another button here to say “save and finalise” or “save and exit”.
But I was unable to event the get that button appeared on the UI…!

This is where I want it to appear: https://www.evernote.com/l/AOVmlueizv9MGaEJDcpKB8ULmr6tMKPYEfE

Does anyone know of a good tutorial/ example that I can follow? The above example is missing a lot of information and I can’t figure out why it is not working.

This is one approach I’ve tried



    public function getCMSActions() {
        $actions = parent::getCMSActions(); 
        $saveAction = new FormAction ('saveExit', 'Save and exit');
        $saveAction->addExtraClass('ss-ui-action-constructive');
        $actions->push($saveAction); 
        return $actions;
    }

    public function getCMSFields()

    {
        $fields = parent::getCMSFields();
        $fields->addFieldToTab('Root.Main', 
            FormAction::create('saveExit', 'Save exit')
        );
     //other fields
    return $fileds
}

Thanks,
Isuru

This issue indicates that the documentation is wrong :slightly_frowning_face: but unfortunately doesn’t say the right way to do it.

1 Like