You are here

public function DeleteMultiple::submitForm in Feeds 8.3

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/DeleteMultiple.php, line 124

Class

DeleteMultiple
Provides a feed deletion confirmation form.

Namespace

Drupal\feeds\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  if ($form_state
    ->getValue('confirm') && !empty($this->feeds)) {
    $this->storage
      ->delete($this->feeds);
    $this->tempStoreFactory
      ->get('feeds_feed_multiple_delete_confirm')
      ->delete($this->user
      ->id());
    $count = count($this->feeds);
    $this
      ->logger('feeds')
      ->notice('Deleted @count feeds.', [
      '@count' => $count,
    ]);
    $this
      ->messenger()
      ->addMessage($this
      ->formatPlural($count, 'Deleted 1 feed.', 'Deleted @count feeds.'));
  }
  $form_state
    ->setRedirectUrl($this
    ->getCancelUrl());
}