Allow views custom plugins on a particular filter criteria only I have started to create a custom views plugin to sort the fields in view according to the video views(not node views but youtube views) on my video content type.
This is how I've implemented hook_views_data():

$data = array();

$data['post_video_views']['table']['group'] = t('PROJECT_NAME');

$data['post_video_views']['table']['join'] = array(
  'node' =&gt; array(
    'left_field' =&gt; 'nid',
    'field' =&gt; 'nid',
  ),
);

$data['post_video_views']['popular'] = array(
  'title' =&gt; t('Popular videos'),
  'help' =&gt; t('Youtube views'),
  'field' =&gt; array(
    'handler' =&gt; 'views_handler_field',
  ),
  'sort' =&gt; array(
    'handler' =&gt; 'views_handler_sort',
  ),
);


This gives me an option to sort ascending and descending and also provides the fields to add. Everything working fine till this step.

Now, I want that this options should only appear when when I have the following filter criteria satisfied: Content: Type (= Video). How can this be done? I know this should be simple to do but just don't know where to do it.

P.S: I am using Views 3 with D 7.22.
You can use a hook_form_alter to add a conditional display of your filter based on the video selected option.

 /*
  *Implement hook_form_alter
  */

function MY_MODULE_form_alter(&amp;$form, &amp;$form_state, $form_id) {
   //dsm($form) -&gt; to get the form['#id']
   if ($form['#id'] == 'views-exposed-form-YOUR_VIEWS_NAME-DISPLAY') {
      $form['YOUR_FIELD_NAME']['#states'] = array(
       'visible' =&gt; array(
        ':input[name="THE_VIDEO_FIELD_NAME"]' =&gt; array('value' =&gt; 'THE_VIDEO_KEY'),
        ),
     );


   }
}


YOUR_FIELD_NAME is the field to display conditionally