You are here

public function ImageStyleDeleteForm::submitForm in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/image/src/Form/ImageStyleDeleteForm.php \Drupal\image\Form\ImageStyleDeleteForm::submitForm()
  2. 10 core/modules/image/src/Form/ImageStyleDeleteForm.php \Drupal\image\Form\ImageStyleDeleteForm::submitForm()

Overrides EntityDeleteFormTrait::submitForm

File

core/modules/image/src/Form/ImageStyleDeleteForm.php, line 62

Class

ImageStyleDeleteForm
Creates a form to delete an image style.

Namespace

Drupal\image\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {

  // Save a selected replacement in the image style storage. It will be used
  // later, in the same request, when resolving dependencies.
  if ($replacement = $form_state
    ->getValue('replacement')) {

    /** @var \Drupal\image\ImageStyleStorageInterface $storage */
    $storage = $this->entityTypeManager
      ->getStorage($this->entity
      ->getEntityTypeId());
    $storage
      ->setReplacementId($this->entity
      ->id(), $replacement);
  }
  parent::submitForm($form, $form_state);
}