🇬🇧United Kingdom @masher

Account created on 14 November 2008, about 16 years ago
#

Recent comments

🇬🇧United Kingdom masher

Cheers for the solution!

I had to amend the above code to work on Drupal 10:

use Drupal\Core\Form\FormStateInterface;

/**
* Implements hook_form_alter().
*/
function hook_form_alter(&$form, FormStateInterface $form_state, $form_id) {
// BEF: close selects of exposed form when value is selected.
if ($form_id == 'views_exposed_form') {
foreach ($form as $k => $v) {
if (str_contains($k, '_collapsible')) {
$form[$k]['#open'] = FALSE;
}
}
}
}

Production build 0.71.5 2024