function ImageStyleDeleteForm::submitForm

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()
  3. 11.x 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);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.