You are here

public function ContentHubImportQueueForm::submitForm in Acquia Content Hub 8

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 ConfigFormBase::submitForm

File

src/Form/ContentHubImportQueueForm.php, line 158

Class

ContentHubImportQueueForm
Form for the Content Hub Import Queue.

Namespace

Drupal\acquia_contenthub\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $trigger = $form_state
    ->getTriggeringElement();
  switch ($trigger['#op']) {
    case 'save':
      $config = $this
        ->config('acquia_contenthub.entity_config');
      $config
        ->set('import_with_queue', $form_state
        ->getValue('import_with_queue'));
      $config
        ->set('import_queue_batch_size', $form_state
        ->getValue('batch_size'));
      $config
        ->set('import_queue_wait_time', $form_state
        ->getValue('wait_time'));
      $config
        ->save();
      break;
    case 'run':
      $form_state
        ->setRedirect('acquia_contenthub.import_queue_batch');
      break;
  }
}