-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
namespace Drupal\search_api_pantheon\Plugin\FormAlter; | ||
|
||
/** | ||
* Class SolrReloadFormAlter. | ||
* | ||
* @FormAlter( | ||
* id = "search_api_pantheon_reload_form_alter", | ||
* label = @Translation("Alter the reload form for the pantheon environment."), | ||
* form_id = { | ||
* "solr_reload_core_form" | ||
* }, | ||
* ) | ||
* | ||
* @package Drupal\search_api_pantheon\Plugin\FormAlter | ||
*/ | ||
class SolrReloadFormAlter extends FormAlterBase { | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function formAlter(array &$form, FormStateInterface $form_state, $form_id) { | ||
// do something here, for example add submit handler. | ||
print_r($form_state->getValues()); | ||
$submit_handler = __CLASS__ . '::formSubmit'; | ||
array_unshift($form['actions']['submit']['#submit'], $submit_handler); | ||
} | ||
|
||
/** | ||
* Custom form submit. | ||
*/ | ||
public static function formSubmit($form, FormStateInterface $form_state) { | ||
print_r($form_state->getValues()); | ||
exit(1); | ||
} | ||
|
||
} |