<p>In case it is useful to anyone upgrading to Craft 2.5, I had to modify the modifyEntrySources to this:</p>

<pre><code>public function modifyEntrySources(&amp;$sources, $context) 
{
  if ($context == 'index')
  {
    $sources[] = array('heading' =&gt; 'Filter articles');

    $sources['link:1'] = array(
        'label' =&gt; 'Articles',
        'criteria' =&gt; array('section' =&gt; 'blog', 'type' =&gt; 'article')
    );
    $sources['link:2'] = array(
        'label' =&gt; 'Links',
        'criteria' =&gt; array('section' =&gt; 'blog', 'type' =&gt; 'link')
    );

}
</code></pre>

<p>Note the need for unique indexes <strong>$sources['link:1']</strong></p>

CC BY-SA 3.0
2015-12-03T14:41:42.200Z
2015-12-03T14:41:42.200Z
Simon Leadbetter
<p>To enable sorting on Entry Types in the Section's index table, you can add this to a custom plugin's primary class:</p>

<pre><code>public function modifyEntrySortableAttributes(&amp;$attributes)
{
    $attributes['typeId'] = Craft::t('Entry Type');
}
</code></pre>

<p>Note that AFAIK there's no way to sort on Entry Type <em>name</em>, only the Entry Type <em>ID</em>.</p>

<p>If you don't want to write a custom plugin, I already wrote one called <a href="https://github.com/mmikkel/CpSortableCustomColumns-Craft" rel="nofollow">CP Sortable Custom Columns</a> which will add Entry Type to the index table's sortable attributes automatically, provided the Entry Type has been added to and is visible in the Section's index table (for instance, via the Customizable Element Index feature).</p>

CC BY-SA 3.0
2016-02-03T11:11:36.737Z
2016-02-03T11:11:36.737Z
Mats Mikkel Rummelhoff
<p>What you can do is to create additional entry sources using the <a href="http://buildwithcraft.com/docs/plugins/hooks-reference#modifyEntrySources" rel="noreferrer"><code>modifyEntrySources</code></a> hook.</p>

<p>This is a very simple example, that will add a heading and two sources to the end of the
sources list (below your default Singles, Channels and Structure sources).</p>

<pre><code>public function modifyEntrySources(&amp;$sources, $context)
{
    $newSources = array(
        array('heading' =&gt; 'Post Formats'),
        array(
            'label' =&gt; 'Articles',
            'criteria' =&gt; array('section' =&gt; 'blog', 'type' =&gt; 'article')
        ),
        array(
            'label' =&gt; 'Links',
            'criteria' =&gt; array('section' =&gt; 'blog', 'type' =&gt; 'link')
        )
    );

    $sources = array_merge($sources, $newSources);
}
</code></pre>

<p>You could also get all entry types of a section with <code>getEntryTypes()</code> and add them programatically if you want.</p>

CC BY-SA 3.0
2015-10-07T17:45:16.877Z
See comments above for more info on this
Simon Leadbetter
CC BY-SA 3.0
2015-10-07T16:54:33.107Z
2015-10-07T16:54:33.107Z
carlcs
<p>We have a channel called Articles with multiple entry types. Is it possible to filter the entries within Craft (on the Entries page) by entry type?</p>

CC BY-SA 3.0
2015-10-07T16:57:51.957Z
With *"on the Entries page"* you meant the Entries Index page in the CP, right? Forgot to ask this before trying to give an answer...
carlcs
CC BY-SA 3.0
2015-10-07T17:07:30.160Z
Yup. The Entries Index page in the CP is exactly where I mean. My client has asked if this is possible as they want to filter the long Articles list by entry type. Is your answer based on this assumption? If so would I need to modify a core file?
Simon Leadbetter
CC BY-SA 3.0
2015-10-07T17:44:13.107Z
A simple yet perfect solution. That worked a treat – thank you.
Simon Leadbetter
<entries><control-panel><search><filter>
Filter entries by entry type in the CP?
# Filter entries by entry type in the CP?

(Asked by: username_0 on 2015-10-07)

We have a channel called Articles with multiple entry types. Is it possible to filter the entries within Craft (on the Entries page) by entry type?

**Tags:** entries, control-panel, search, filter

> **Comments:**
> **username_1**: With *"on the Entries page"* you meant the Entries Index page in the CP, right? Forgot to ask this before trying to give an answer...  
> **username_0**: Yup. The Entries Index page in the CP is exactly where I mean. My client has asked if this is possible as they want to filter the long Articles list by entry type. Is your answer based on this assumption? If so would I need to modify a core file?  
> **username_0**: A simple yet perfect solution. That worked a treat – thank you.  

---

## 3 answers

### Answer by username_1 on 2015-10-07. Score: 5 | Accepted answer

What you can do is to create additional entry sources using the modifyEntrySources hook.
This is a very simple example, that will add a heading and two sources to the end of the
sources list (below your default Singles, Channels and Structure sources).
public function modifyEntrySources(&$sources, $context)
{
    $newSources = array(
        array('heading' => 'Post Formats'),
        array(
            'label' => 'Articles',
            'criteria' => array('section' => 'blog', 'type' => 'article')
        ),
        array(
            'label' => 'Links',
            'criteria' => array('section' => 'blog', 'type' => 'link')
        )
    );

    $sources = array_merge($sources, $newSources);
}

You could also get all entry types of a section with getEntryTypes() and add them programatically if you want.

> **Comments:**
> **username_0**: See comments above for more info on this  

---

### Answer by username_0 on 2015-12-03. Score: 2

In case it is useful to anyone upgrading to Craft 2.5, I had to modify the modifyEntrySources to this:
public function modifyEntrySources(&$sources, $context) 
{
  if ($context == 'index')
  {
    $sources[] = array('heading' => 'Filter articles');

    $sources['link:1'] = array(
        'label' => 'Articles',
        'criteria' => array('section' => 'blog', 'type' => 'article')
    );
    $sources['link:2'] = array(
        'label' => 'Links',
        'criteria' => array('section' => 'blog', 'type' => 'link')
    );

}

Note the need for unique indexes $sources['link:1']


---

### Answer by username_2 on 2016-02-03. Score: 2

To enable sorting on Entry Types in the Section's index table, you can add this to a custom plugin's primary class:
public function modifyEntrySortableAttributes(&$attributes)
{
    $attributes['typeId'] = Craft::t('Entry Type');
}

Note that AFAIK there's no way to sort on Entry Type name, only the Entry Type ID.
If you don't want to write a custom plugin, I already wrote one called CP Sortable Custom Columns which will add Entry Type to the index table's sortable attributes automatically, provided the Entry Type has been added to and is visible in the Section's index table (for instance, via the Customizable Element Index feature).


---

