You are here

public function PagererPresetFormBase::form in Pagerer 8

Same name and namespace in other branches
  1. 8.2 src/Form/PagererPresetFormBase.php \Drupal\pagerer\Form\PagererPresetFormBase::form()

Gets the actual form array to be built.

Overrides EntityForm::form

See also

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

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

2 calls to PagererPresetFormBase::form()
PagererPresetEditForm::form in src/Form/PagererPresetEditForm.php
Gets the actual form array to be built.
PagererPresetPaneEditForm::form in src/Form/PagererPresetPaneEditForm.php
Gets the actual form array to be built.
2 methods override PagererPresetFormBase::form()
PagererPresetEditForm::form in src/Form/PagererPresetEditForm.php
Gets the actual form array to be built.
PagererPresetPaneEditForm::form in src/Form/PagererPresetPaneEditForm.php
Gets the actual form array to be built.

File

src/Form/PagererPresetFormBase.php, line 80

Class

PagererPresetFormBase
Base form handler for image style add and edit forms.

Namespace

Drupal\pagerer\Form

Code

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