From 0fa29c5cd97c9a54452c046404b16a12776e73b9 Mon Sep 17 00:00:00 2001 From: Tom Stovall Date: Thu, 14 Nov 2024 07:14:12 -0800 Subject: [PATCH] linting form alter --- composer.json | 1 + src/Plugin/FormAlter/SolrReloadFormAlter.php | 24 ++++++++++++-------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/composer.json b/composer.json index 58039df4..11e308e1 100644 --- a/composer.json +++ b/composer.json @@ -41,6 +41,7 @@ "ext-curl": "*", "ext-json": "*", "ext-zip": "*", + "drupal/pluginformalter": "^1", "drupal/search_api_solr": "^4.3", "guzzlehttp/guzzle": "^6.5.7|^7.5", "http-interop/http-factory-guzzle": "^1.0", diff --git a/src/Plugin/FormAlter/SolrReloadFormAlter.php b/src/Plugin/FormAlter/SolrReloadFormAlter.php index 9d566f45..2364ab0a 100644 --- a/src/Plugin/FormAlter/SolrReloadFormAlter.php +++ b/src/Plugin/FormAlter/SolrReloadFormAlter.php @@ -1,11 +1,16 @@ getValues()); - $submit_handler = __CLASS__ . '::formSubmit'; - array_unshift($form['actions']['submit']['#submit'], $submit_handler); + // override the default form submit and use ours. + $form['#submit'][] = __CLASS__ . '::formSubmit'; } /** * Custom form submit. */ public static function formSubmit($form, FormStateInterface $form_state) { - print_r($form_state->getValues()); - exit(1); + $rl = \Drupal::service("search_api_pantheon.reload"); + $rl->reloadServer(); } -} \ No newline at end of file +}