function ImageStyleFormBase::form

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

Overrides EntityForm::form

1 call to ImageStyleFormBase::form()
ImageStyleEditForm::form in core/modules/image/src/Form/ImageStyleEditForm.php
Gets the actual form array to be built.
1 method overrides ImageStyleFormBase::form()
ImageStyleEditForm::form in core/modules/image/src/Form/ImageStyleEditForm.php
Gets the actual form array to be built.

File

core/modules/image/src/Form/ImageStyleFormBase.php, line 51

Class

ImageStyleFormBase
Base form for image style add and edit forms.

Namespace

Drupal\image\Form

Code

public function form(array $form, FormStateInterface $form_state) {
    $form['label'] = [
        '#type' => 'textfield',
        '#title' => $this->t('Image style name'),
        '#default_value' => $this->entity
            ->label(),
        '#required' => TRUE,
    ];
    $form['name'] = [
        '#type' => 'machine_name',
        '#machine_name' => [
            'exists' => [
                $this->imageStyleStorage,
                'load',
            ],
        ],
        '#default_value' => $this->entity
            ->id(),
        '#required' => TRUE,
    ];
    return parent::form($form, $form_state);
}

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