You are here

public function SolrUploadConfigsetForm::submitForm in Search API Solr 4.x

Form submission handler.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Overrides FormInterface::submitForm

File

modules/search_api_solr_admin/src/Form/SolrUploadConfigsetForm.php, line 86

Class

SolrUploadConfigsetForm
The upload configset form.

Namespace

Drupal\search_api_solr_admin\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  try {
    $this->commandHelper
      ->uploadConfigset($this->search_api_server
      ->id(), (int) $form_state
      ->getValue('num_shards'), TRUE);
  } catch (\Exception $e) {
    $this->messenger
      ->addError($e
      ->getMessage());
    $this
      ->logException($e);
  }
  $form_state
    ->setRedirect('entity.search_api_server.canonical', [
    'search_api_server' => $this->search_api_server
      ->id(),
  ]);
}