In drupal 7 i used this hook to implement user filter form (People->Filter). This hook doesn't work in drupal 8. Any suggestions?

 * Implements hook_form_FORM_ID_alter().
function cl_form_user_filter_form_alter(&$form, &$form_state, $form_id) {
  //code here

Well, i added this function to my module, but no results at all. Am i doing something wrong?

function cl_form_views_exposed_form_alter(&$form, &$form_state, $form_id)
  $form['actions']['find_users']  = array(
          '#type' => 'submit',
          '#value' => t('Check for users'),
          '#submit' => array('cl_find_users'),

2 Answers 2


The form "user_filter_form" you are trying to alter doesn't exist. In D8 /admin/people is a view. You can configure the view including the exposed filter here:


You can still list peoples without Views. When you disable user_admin people the user module displays a basic entity list, but this doesn't contain a filter form anymore like it did in D7. Probably not many will notice, because D8 enables the admin views for content and people by default.

  • I need to add custom button to this form/view. How can i do this?
    – ArtNoArt
    Commented Jul 6, 2017 at 17:20
  • mymodule_form_views_exposed_form_alter()
    – 4uk4
    Commented Jul 6, 2017 at 17:51
  • I update my first message, could you please check it?
    – ArtNoArt
    Commented Jul 7, 2017 at 9:01
  • What issue do you have with the code?
    – 4uk4
    Commented Jul 7, 2017 at 9:31
  • I just need to add my custom submit button near the "Filter" button on this form.
    – ArtNoArt
    Commented Jul 7, 2017 at 9:40

This hook still works check the documentation.

Use \Drupal\Core\Form\FormStateInterface $form_state instead of &$form_state, make sure your module is enabled and clear your cache.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.