Commit 7157b6e9 authored by Martin Keereman's avatar Martin Keereman
Browse files

Issue #3106417 by Etroid: multiple selections filter breaks when filter is collapsible

parent d1c7be6a
......@@ -2,6 +2,8 @@
namespace Drupal\better_exposed_filters\Plugin\better_exposed_filters\filter;
use Drupal\Core\Form\FormStateInterface;
/**
* Default widget implementation.
*
......@@ -19,4 +21,24 @@ class DefaultWidget extends FilterWidgetBase {
return TRUE;
}
/**
* {@inheritdoc}
*/
public function exposedFormAlter(array &$form, FormStateInterface $form_state) {
$field_id = $this->getExposedFilterFieldId();
$type = $this->getExposedFilterWidgetType();
parent::exposedFormAlter($form, $form_state);
if ($type === 'select') {
// Workaround to add support for merging process and pre-render functions
// to the render array of an element.
// @todo remove once core issue is resolved.
// @see https://www.drupal.org/project/drupal/issues/2070131
$form[$field_id]['#process'][] = ['\Drupal\Core\Render\Element\Select', 'processSelect'];
$form[$field_id]['#process'][] = ['\Drupal\Core\Render\Element\Select', 'processAjaxForm'];
$form[$field_id]['#pre_render'][] = ['\Drupal\Core\Render\Element\Select', 'preRenderSelect'];
}
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment