Trying to write my own Views filter handler Partially as an exercise, partially as a real need, I'm trying to wrap up a views plugin to provide a filter labeled Taxonomy Term: Has children terms - so to allow terms that do/don't have direct children (depending on the option form setting). So far none of my hits was successful, they all ended up in "Broken handler" messages. Most probably because I declare table relations the wrong way.

Looking at how taxonomy.views.inc does it:

$data['taxonomy_term_hierarchy']['parent'] = array(
  // ...
);


I tried:

function taxfil_views_data() {
  $data = array();
  $data['taxonomy_term_hierarchy']['tid'] = array(
   'title' =&gt; t('Has children terms'),
   'help' =&gt; t('Check if the term has direct children'),
   'relationship' =&gt; array(
      'base' =&gt; 'taxonomy_term_data',
      'field' =&gt; 'tid',
      'label' =&gt; t('Has kids'),
   ),
   'filter' =&gt; array(
      'help' =&gt; t('My Help'),
      'handler' =&gt; 'views_handler_filter_taxfil',
    ),
  );
  return $data
}


I am also unsure about the parent class of the filter handler to extend, but at this point I'm close to thinking it does not really matter, as there is bigger problem in front of it.

Usually the example/tutorials base on own tables that a module creates, whereas mine has to re-use the existing.

Could anyone point me to the right direction?
In your specific case, since "taxonomy_term_hierarchy" already exists in the views data, you want to implement hook_views_data_alter() instead, making your implementation much simpler (untested):

function foo_views_data_alter(&amp;$data) {
  $data['taxonomy_term_hierarchy']['has_children'] = array(
    'title' =&gt; t('Has children terms'),
    'help' =&gt; t('Check if the term has direct children'),
    'filter' =&gt; array(
      'help' =&gt; t('My Help'),
      'handler' =&gt; 'views_handler_filter_term_children',
    ),
  );
}


As far as what filter to extend, a good one might be views_handler_filter_boolean_operator but you can just start from views_handler_filter too.