Jump to content

ProcessPageListActions: adding extra actions to actions


Recommended Posts

Hello everybody!

One of my clients seems to be using the extra page actions a lot, and he is rather that they are visible to him without clicking the "extras" icon (">") to expand.

So I decided I'd throw a couple of hooks to add some extra page actions to the regular page actions, so that they become instantly accessible without the need to expand the extras.

Here's a fragment of code from my /site/ready.php

I was trying to use a global variable to store the extra actions array but I don't seem to be able to use it in the second hook.

 * A couple of hooks to add page action
 * "unpub" to the list of non-ajax page actions
 * alongside with "new", "edit" etc

wire()->addHookAfter("ProcessPageListActions::getExtraActions", function($event) {
    global $extraActions;
    $extraActions = $event->return;

wire()->addHookAfter("ProcessPageListActions::getActions", function($event) {
    $actions = $event->return;
    global $extraActions;
    $actions['unpub'] = $extraActions['unpub'];

    $event->return = $actions;

Somehow var_dump(extraActions) keeps giving me a NULL.

I don't really think I should develop a whole module just to change the list of page actions; I just need the extras to be immediately visible without the click. Could you please help me out? 

Any hints or solutions are more than welcome!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...