You are here

public function PurgerMoveForm::movePurger in Purge 8.3

Move the purger.

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/PurgerMoveForm.php, line 149

Class

PurgerMoveForm
Move purger {id} in the purger execution order - 'up' or 'down'.

Namespace

Drupal\purge_ui\Form

Code

public function movePurger(array &$form, FormStateInterface $form_state) {
  $response = new AjaxResponse();
  $response
    ->addCommand(new CloseModalDialogCommand());
  if (isset($this->purgePurgers
    ->getPluginsEnabled()[$this->id])) {
    $response
      ->addCommand(new ReloadConfigFormCommand('edit-purgers'));
    if ($this->direction === 'up') {
      $this->purgePurgers
        ->movePurgerUp($this->id);
    }
    elseif ($this->direction === 'down') {
      $this->purgePurgers
        ->movePurgerDown($this->id);
    }
  }
  return $response;
}