You are here

public function ImageAPIOptimizePipelineDeleteForm::submitForm in Image Optimize (or ImageAPI Optimize) 8.2

Same name and namespace in other branches
  1. 8.3 src/Form/ImageAPIOptimizePipelineDeleteForm.php \Drupal\imageapi_optimize\Form\ImageAPIOptimizePipelineDeleteForm::submitForm()
  2. 4.x src/Form/ImageAPIOptimizePipelineDeleteForm.php \Drupal\imageapi_optimize\Form\ImageAPIOptimizePipelineDeleteForm::submitForm()

Overrides EntityDeleteFormTrait::submitForm

File

src/Form/ImageAPIOptimizePipelineDeleteForm.php, line 60

Class

ImageAPIOptimizePipelineDeleteForm
Creates a form to delete an image optimize pipeline.

Namespace

Drupal\imageapi_optimize\Form

Code

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

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

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