You are here

public function OverviewForm::submitForm in Queue UI 8.2

We need this method, but each button has its own submit handler.

Parameters

array $form:

\Drupal\Core\Form\FormStateInterface $form_state:

Overrides FormInterface::submitForm

File

src/Form/OverviewForm.php, line 277

Class

OverviewForm
Class QueueUIOverviewForm @package Drupal\queue_ui\Form

Namespace

Drupal\queue_ui\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $form_state
    ->cleanValues();
  foreach ($form_state
    ->getValue('cron') as $name => $time) {
    $this->state
      ->set('queue_ui_cron_' . $name, $time);
  }

  // Only save the weight if the queue_order module is available.
  if ($this->moduleHandler
    ->moduleExists('queue_order')) {
    $order_config = $this
      ->configFactory()
      ->getEditable('queue_order.settings');

    // Save the weight of the defined workers.
    foreach ($form_state
      ->getValue('weight') as $name => $weight) {
      $order_config
        ->set('order.' . $name, (int) $weight);
    }
    $order_config
      ->save();
  }

  // Clear the cached plugin definition so that changes come into effect.
  $this->queueWorkerManager
    ->clearCachedDefinitions();
}