ImageStyleFormBase::form

public ImageStyleFormBase::form(array $form, FormStateInterface $form_state)

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/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'] = array(
    '#type' => 'textfield',
    '#title' => $this->t('Image style name'),
    '#default_value' => $this->entity->label(),
    '#required' => TRUE,
  );
  $form['name'] = array(
    '#type' => 'machine_name',
    '#machine_name' => array(
      'exists' => array($this->imageStyleStorage, 'load'),
    ),
    '#default_value' => $this->entity->id(),
    '#required' => TRUE,
  );

  return parent::form($form, $form_state);
}
doc_Drupal
2016-10-29 09:19:52
Comments
Leave a Comment

Please login to continue.