Im using the modifyEntrySources hook in my plugin, when I view the entries based on my custom criteria it doesn't show the checkboxes for element actions, is there a way to get these back or is this a bug?


The checkboxes will only show up if there is at least one available element action for the current source.

Element actions are defined by element types’ getAvailableActions() methods, which will vary their response based on the $source that is passed in.

In EntryElementType’s case, if an unrecognized $source is passed in, then no actions will be returned.

However, EntryElementType::getAvailableActions() does have a hook called addEntryActions, which gives plugins the opportunity to add additional actions to its response.

So on top of using the modifyEntrySources hook, you can also use the addEntryActions hook to provide the actions that your custom source should have.

public function addEntryActions($source)
    if ($source == 'myCustomSourceKey')
        $elementType = craft()->elements->getElementType(ElementType::Entry);
        return $elementType->getAvailableActions('section:X');

(Replace X with the ID of a section you want to mimic.)

  • Ahhhh! Awesome, thanks Brandon! Much appreciated :) – jonleesmith Feb 20 '15 at 22:51
  • Hey Brandon, I just tried this out. With a help from looking in the resources tab in chrome developer tools and the handy die() function, the addEntryActions doesn't seem to be running on my custom source keys, runs on the system sources though fine... – jonleesmith Feb 20 '15 at 23:56
  • Ah yes, sorry you're right. I'll tweak that for the next release! – Brandon Kelly Feb 21 '15 at 0:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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