function ImageStyleDeleteForm::form

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

Overrides EntityForm::form

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);
}

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