From hook_menu documentation:

MENU_LOCAL_ACTION: Local actions are menu items that describe actions on the parent item such as adding a new user or block, and are rendered in the action-links list in your theme.
MENU_LOCAL_TASK: Local tasks are menu items that describe different displays of data, and are generally rendered as tabs.

I think a local actions are more appropriate for (un)publish links.

Comments

simon georges’s picture

Status: Active » Needs review
StatusFileSize
new983 bytes

A patch doing exactly that for those wanting it.

hansfn’s picture

I agree that MENU_LOCAL_ACTION is better than MENU_LOCAL_TASK. I must admin that I was surprised the first time I clicked the "Unpublish" tab - the node was directly unpublished. (I didn't expect that from a tab.)

I tried the patch above and while it replaces the task with an action, I'm not 100% happy. I think the action link should be displayed on the "Edit page", not on the "View page". In addition some stuff could be removed.

New patch attached.

hansfn’s picture

OK, it seems there is a problem with my patch. Moving the action to the "Edit page" gives "access denied" when the action link is clicked. Argh, I don't see what I do wrong.

simon georges’s picture

Access arguments should now be (1, 4) since you're adding a component to the URL.

The point of the module is to be as fast as possible, so I'm not in favour of moving the action to the edit tab. But if it's the will of the community, I'll stick to it ;-)

hansfn’s picture

Thx for the explanation about access arguments.

I have thought a little bit more about this. I buy the argument about quick access, and it is possible to turn of the tabs in the module configuration. Maybe a solution is that you add MENU_LOCAL_ACTION (like in my patch) in addition to the tabs or display the action when the tabs are disabled?

simon georges’s picture

Maybe. Can we have the input of other people using the module? What do you think?

johnennew’s picture

Status: Needs review » Fixed

This functionality has been added as an option to the 7.x-1.x branch as part of #1948966: Switch tab to a button instead

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.