I would like to add a button to the edit entry screen, only for already saved entries, alongside the "Share" button.

When clicked, I'd like to call my plugin's controller action and post the entry ID.

Where would I look to see how to do this?

2 Answers 2


Not sure if you can put it next to the Share button, but check out the Triggers feature of Button Box...


You can create a "Triggers" field, which is just a button that hooks up to JS. Then use the JS to ping your Controller via AJAX.

The button exists as a field, so you could just put that field at the top of your field layout. It's not well documented, but it's really easy to do.

  • Thanks for the reply! I need this to be more tightly integrated via my plugin, though. It's a workflow thing. And I need to link to another CP screen, passing along the entry ID. Commented Jun 11, 2018 at 1:00

I learned in this ticket that you can do this with Craft::$app->getView()->hook() in your plugin's init() method. It won't put the button in the top near the "Share" button but rather in the sidebar under the settings. Here's an example (you'll want to customize it to your liking):

Craft::$app->getView()->hook('cp.entries.edit.details', function(array &$context) {

    $entry = $context['entry'];

    if ((int)$entry->sectionId === YOUR_SECTION_ID_HERE) {

        $url = '/your/controller/action/url/';

        return '<div class="meta"><a href="' . $url . '" class="btn">My Button</a></div>';


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.