I have a custom element index with an element action to 'Approve' elements.

The element index has 'Live' and 'Staged' sources.

Where/how do I set it to only show this action on the 'staged' source OR just on a selection that contains an element that is not approved (latter probably better).

I've looked at the existing 'Delete' action and see that this uses a data attribute on the element index items 'data-deletable', how do I inject my own data attribute into the listing i.e. 'date-approvable'?

1 Answer 1


I've figured out how I can do it, but it doesn't feel like the best way.

What I've done is hooked on to the showActionTrigger event, then hidden the button if the source != 'staged'

showActionTriggers: function() {
    if (this.$source.data('key') != 'staged')

I have a feeling the best way is to build the JS on the element action class, under getTriggerHtml, but this will do for now.

Slowly getting my head around the CP js 🤯

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.