You are here

public function DeleteMultiple::submitForm in Profile 2 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/DeleteMultiple.php, line 119
Contains \Drupal\node\Form\DeleteMultiple.

Class

DeleteMultiple
Provides a node deletion confirmation form.

Namespace

Drupal\profile\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  if ($form_state
    ->getValue('confirm') && !empty($this->profiles)) {
    $this->storage
      ->delete($this->profiles);
    $this->privateTempStoreFactory
      ->get('profile_multiple_delete_confirm')
      ->delete(\Drupal::currentUser()
      ->id());
    $count = count($this->profiles);
    $this
      ->logger('content')
      ->notice('Deleted @count profiles.', array(
      '@count' => $count,
    ));
    drupal_set_message(\Drupal::translation()
      ->formatPlural($count, 'Deleted 1 profile.', 'Deleted @count profiles.'));
  }
  $form_state
    ->setRedirect('profile.overview_profiles');
}