🇧🇭Bahrain @Jed_BH

Account created on 12 July 2014, over 10 years ago
#

Recent comments

🇧🇭Bahrain Jed_BH

So, I installed this module today and noticed the same issue. So, I fired up Xdebug and found out that in the module, there is these lines:

function better_search_form_alter(&$form, FormStateInterface $form_state, $form_id) {

  $block_form_id = \Drupal::config('better_search.settings')->get('block_form_id');

The main issue here is that while the ID being pulled from the settings form, in my case, is = views-exposed-form-search-page-1

The id being retrieved from $form_id is only = views_exposed_form

Thus, the evaluation of $form_id against $block_form_id is false.

So, to rectify this I changed the module lines to:

function better_search_form_alter(&$form, FormStateInterface $form_state, $form_id) {

  $block_form_id = \Drupal::config('better_search.settings')->get('block_form_id');
  $input_name = \Drupal::config('better_search.settings')->get('input_name');
  $full_form_id = isset($form['#id']) ? $form['#id'] : '';
  if ($form_id == $block_form_id || $form_id == 'search_form' || $full_form_id == $block_form_id) {

I am not confident in this, but it solved the issue of this thread. However, the attached library won't work without further tweaks with my exposed form filter for search_api.

Production build 0.71.5 2024