How can I set up sources based on my custom field data?
Setting up the sources in the sidebar isn't difficult. Add the modifyEntrySources()(link) hook to MyCustomPlugin.php.

public function modifyEntrySources(&amp;$sources, $context)
{
    if ($context == 'index')
    {
        $sources[] = array('heading' =&gt; 'My Custom Heading');

        $sources['mypluginhandle:mysectionname'] = array(
            'label' =&gt; 'My Section Name',
            'criteria' =&gt; array('myPluginHandle' =&gt; 'SQL CODE HERE')
        );
    }
}


At this point you should have a new entry heading and source in the Entries Listing page. Clicking on it isn't going to filter your data as you may expect... yet.

Notice the 'criteria' =&gt; array('myPluginHandle' =&gt; 'SQL CODE HERE')? This is what you are going to use to filter the entries according to what you want to see. Everything that is in the value of the 'myPluginHandle' array will be passed over to the modifyElementsQuery() (link) method in the MyCustomFieldtype.php file. This is where you can build out your SQL statement accordingly.

public function modifyElementsQuery(DbCommand $query, $params)
{
    if ($params != null) {

        // whatever you need to do to dig in to your custom fields' data...
        // using the code above, $params would be equal to 'SQL CODE HERE'

        $query-&gt;where($params);
    }
}


This should be all you need to filter your entries by your custom field!