You are here

public function QueuerAddForm::addQueuer in Purge 8.3

Add the queuer.

Parameters

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

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

Return value

\Drupal\Core\Ajax\AjaxResponse The AJAX response object.

File

modules/purge_ui/src/Form/QueuerAddForm.php, line 106

Class

QueuerAddForm
Add a queuer.

Namespace

Drupal\purge_ui\Form

Code

public function addQueuer(array &$form, FormStateInterface $form_state) {
  $response = new AjaxResponse();
  $id = $form_state
    ->getValue('id');
  $response
    ->addCommand(new CloseModalDialogCommand());
  if (in_array($id, $this->purgeQueuers
    ->getPluginsAvailable())) {
    $enabled = $this->purgeQueuers
      ->getPluginsEnabled();
    $enabled[] = $id;
    $this->purgeQueuers
      ->setPluginsEnabled($enabled);
    $response
      ->addCommand(new ReloadConfigFormCommand('edit-queue'));
  }
  return $response;
}