Adding Select2 to the Content type filer on the Content Admin page

Created on 15 April 2025, 13 days ago

Problem/Motivation

I am trying to ass the Select 2 widget to the 'Content type' filer on the standard Content Admin page (/admin/content).

Reading around all over, I am assured that adding the following to my custom module form_alter() implementation should do the trick but to no avail...

function MY_MODULE_form_alter(&$form, FormStateInterface $form_state, $form_id): void {
 // Add the Select 2 widget to the Content admin page
  if ($form_id === 'views_exposed_form') {
    if (isset($form['type'])) {
      $form['type']['#select2'] = TRUE;
    }
  }
}

I have tried all sorts of variations but can't seem to get the Select 2 JS to kick in.

Can anyone please advise?

Thank you

💬 Support request
Status

Active

Version

2.0

Component

User interface

Created by

🇬🇧United Kingdom SirClickALot Somerset

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024