Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.

Hot answers tagged

1

I have tested it too, it seems not working with MYTHEME_form_FROM_ID_alter there is another way to do so. Implements hook_theme /** * Implements hook_theme(). */ function MyModule_theme($existing, $type, $theme, $path) { return [ 'search_block_form' => [ 'base hook' => 'form', 'template' => 'form--search-block-form', ], ]; } ...


1

It's fairly straight forward PHP mistake $form['#attributes']['class'] is an array of classes And by doing $form['#attributes']['class'] = 'form-inline'; you're saying forget whatever $form['#attributes']['class'] was before its now a string that contains 'form-inline'. So you're changing the variable from an array to a string. Long story short you should ...


1

Just added a video link to show you : imgur.com/EmVha6e You just need to add a conditional to check if it's not ajax $request = \Drupal::request(); $is_ajax = $request->isXmlHttpRequest(); if (!is_ajax) { // code that sets the filter initial value } Credit: How can I detect AJAX request inside Drupal?


Only top voted, non community-wiki answers of a minimum length are eligible