You are here

public function PathautoBulkUpdateForm::submitForm in Pathauto 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 FormInterface::submitForm

File

src/Form/PathautoBulkUpdateForm.php, line 123

Class

PathautoBulkUpdateForm
Configure file system settings for this site.

Namespace

Drupal\pathauto\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $batch = [
    'title' => $this
      ->t('Bulk updating URL aliases'),
    'operations' => [
      [
        'Drupal\\pathauto\\Form\\PathautoBulkUpdateForm::batchStart',
        [],
      ],
    ],
    'finished' => 'Drupal\\pathauto\\Form\\PathautoBulkUpdateForm::batchFinished',
  ];
  $action = $form_state
    ->getValue('action');
  foreach ($form_state
    ->getValue('update') as $id) {
    if (!empty($id)) {
      $batch['operations'][] = [
        'Drupal\\pathauto\\Form\\PathautoBulkUpdateForm::batchProcess',
        [
          $id,
          $action,
        ],
      ];
    }
  }
  batch_set($batch);
}