how to add exposed drop-down filter with options in a view of custom table In a drupal 7 website, I have a view that is based on a custom table. I have a status column in that custom table, which is type of integer and has 0 or 1 value, and in a view I want to add exposed filter with dropdown, with values somehow like below
$options[0] = 'No';
$options[1] = 'Yes';

So that a user can choose a value from dropdown and filter out data.
So in my views.inc file I have implemented hook_views_data(), then I have added the following code to make that field accessible in a view
$data['custom_users']['status'] = array(
      'title' =&gt; t('User Status'),
      'help' =&gt; t('User Status'),
      'field' =&gt; array(
        'click sortable' =&gt; TRUE,
      ), 
      'filter' =&gt; array(
        'handler' =&gt; 'views_handler_filter_numeric',
      ), 
      'sort' =&gt; array(
        'handler' =&gt; 'views_handler_sort',
      ),
  );

Now when I am trying to add exposed filter using this field I am not able to make it available as dropdown. I am only getting a textfield as exposed filter for this field.
Any help will be appreciated.
You can use hook_form_alter() for this.
simply change the field type to select and add your options.
here is my working code
// implements hook_form_alter
function project_form_alter(&amp;$form, &amp;$form_state, $form_id) {
  if ($form_id === 'views_exposed_form') {
    $view = $form_state['view'];
    // add your view name in 'view_name'.
    if ($view-&gt;name === 'view_name') { 
      // Checking status field is exists or not.
      if (isset($form['status'])) {
        $form['status']['#type'] = 'select';
        $form['status']['#empty_value'] = '';
        $form['status']['#empty_option'] = 'All';
        $form['status']['#options'] = array('0' =&gt; 'No', '1' =&gt; 'Yes');
        $form['status']['#size'] = 1;
        $form['status']['#attributes'] = array('id' =&gt; 'status-list');
      }
    }
  }
}

hope this will work :).