Question

I can add a button on the node edit form using a hook_form_alter and adding a new element to $form['actions'].

However, I would also like to add a button to the node view, next to + Create. I assume there's an api for this but I can't seem to find it in the code or in documentation.

Create action

Was it helpful?

Solution

I found the solution. First, some terminology: the links in the dropdown menu on the bottom right are called Contextual Tabs. Second, the buttons with an icon are called Extracted Tabs. These settings are found in two different locations.

First, make your menu item a regular context tab. Go to admin/openatrium/setting and open the Contextual Tabs fieldset. Fill in the link to your page/menu item:

OA1

Next, extract the Contextual Tab as a button. Go to admin/config/user-interface/contextual-tabs and fill in the link and/or the label to your page/menu item in the Tabs to extract textarea:

OA2

Your link will now be displayed as a button with an icon of your liking.

Licensed under: CC-BY-SA with attribution
Not affiliated with drupal.stackexchange
scroll top