<p>The checkboxes will only show up if there is at least one available <a href="http://buildwithcraft.com/docs/plugins/element-actions" rel="nofollow">element action</a> for the current source.</p>

<p>Element actions are defined by element types’ <a href="http://buildwithcraft.com/classreference/elementtypes/IElementType#getAvailableActions-detail" rel="nofollow">getAvailableActions()</a> methods, which will vary their response based on the <code>$source</code> that is passed in.</p>

<p>In <a href="http://buildwithcraft.com/classreference/elementtypes/EntryElementType" rel="nofollow">EntryElementType’s</a> case, if an unrecognized <code>$source</code> is passed in, then no actions will be returned.</p>

<p>However, <a href="http://buildwithcraft.com/classreference/elementtypes/EntryElementType#getAvailableActions-detail" rel="nofollow">EntryElementType::getAvailableActions()</a> does have a hook called <a href="http://buildwithcraft.com/docs/plugins/hooks-reference#addEntryActions" rel="nofollow">addEntryActions</a>, which gives plugins the opportunity to add additional actions to its response.</p>

<p>So on top of using the <a href="http://buildwithcraft.com/docs/plugins/hooks-reference#modifyEntrySources" rel="nofollow">modifyEntrySources</a> hook, you can also use the addEntryActions hook to provide the actions that your custom source should have.</p>

<pre class="lang-php prettyprint-override"><code>public function addEntryActions($source)
{
    if ($source == 'myCustomSourceKey')
    {
        $elementType = craft()-&gt;elements-&gt;getElementType(ElementType::Entry);
        return $elementType-&gt;getAvailableActions('section:X');
    }
}
</code></pre>

<p>(Replace <code>X</code> with the ID of a section you want to mimic.)</p>

CC BY-SA 3.0
2015-02-20T22:51:20.617Z
Ahhhh! Awesome, thanks Brandon! Much appreciated :)
jonleesmith
CC BY-SA 3.0
2015-02-20T23:56:10.437Z
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
CC BY-SA 3.0
2015-02-21T00:49:56.113Z
Ah yes, sorry you're right. I'll tweak that for the next release!
Brandon Kelly
CC BY-SA 3.0
2015-02-20T22:46:43.347Z
2015-02-20T22:46:43.347Z
Brandon Kelly
<p>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? </p>

<entries><plugins><hook>
Element Actions for Entries being viewed from modifyEntrySources
# Element Actions for Entries being viewed from modifyEntrySources

(Asked by: username_0 on 2015-02-19)

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?

**Tags:** entries, plugins, hook

---

## 1 answers

### Answer by username_1 on 2015-02-20. Score: 4 | Accepted answer

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.)

> **Comments:**
> **username_0**: Ahhhh! Awesome, thanks Brandon! Much appreciated :)  
> **username_0**: 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...  
> **username_1**: Ah yes, sorry you're right. I'll tweak that for the next release!  

---

