You are here

public function ImageStyleDeleteForm::form in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/image/src/Form/ImageStyleDeleteForm.php \Drupal\image\Form\ImageStyleDeleteForm::form()

Gets the actual form array to be built.

Overrides EntityForm::form

See also

\Drupal\Core\Entity\EntityForm::processForm()

\Drupal\Core\Entity\EntityForm::afterBuild()

File

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

Class

ImageStyleDeleteForm
Creates a form to delete an image style.

Namespace

Drupal\image\Form

Code

public function form(array $form, FormStateInterface $form_state) {
  $replacement_styles = $this
    ->getReplacementOptions();

  // If there are non-empty options in the list, allow the user to optionally
  // pick up a replacement.
  if (count($replacement_styles) > 1) {
    $form['replacement'] = [
      '#type' => 'select',
      '#title' => $this
        ->t('Replacement style'),
      '#options' => $replacement_styles,
      '#empty_option' => $this
        ->t('- No replacement -'),
      '#weight' => -5,
    ];
  }
  return parent::form($form, $form_state);
}