public function Autosubmit::exposedFormAlter in Views Autosubmit 8
.
Overrides ExposedFormPluginBase::exposedFormAlter
File
- src/
Plugin/ views/ exposed_form/ Autosubmit.php, line 49
Class
- Autosubmit
- Extends the exposed form to provide an autosubmit functionality.
Namespace
Drupal\views_autosubmit\Plugin\views\exposed_formCode
public function exposedFormAlter(&$form, FormStateInterface $form_state) {
parent::exposedFormAlter($form, $form_state);
// Apply autosubmit values.
$form = array_merge_recursive($form, [
'#attributes' => [
'class' => [
'views-auto-submit-full-form',
],
],
]);
$form['actions']['submit']['#attributes']['class'][] = 'views-use-ajax';
$form['actions']['submit']['#attributes']['class'][] = 'views-auto-submit-click';
$form['#attached']['library'][] = 'views_autosubmit/autosubmit';
if (!empty($this->options['autosubmit_hide'])) {
$form['actions']['submit']['#attributes']['class'][] = 'js-hide';
}
}