You are here

public function LinkConfigurationStorageForm::form in Menu Token 8

Same name and namespace in other branches
  1. 9.1.x src/Form/LinkConfigurationStorageForm.php \Drupal\menu_token\Form\LinkConfigurationStorageForm::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

src/Form/LinkConfigurationStorageForm.php, line 18

Class

LinkConfigurationStorageForm
Class LinkConfigurationStorageForm.

Namespace

Drupal\menu_token\Form

Code

public function form(array $form, FormStateInterface $form_state) {
  $form = parent::form($form, $form_state);

  /** @var \Drupal\menu_token\Entity\LinkConfigurationStorage $link_configuration_storage */
  $link_configuration_storage = $this->entity;
  $form['label'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Label'),
    '#maxlength' => 255,
    '#default_value' => $link_configuration_storage
      ->label(),
    '#description' => $this
      ->t("Label for the Link configuration storage."),
    '#required' => TRUE,
  ];
  $form['id'] = [
    '#type' => 'machine_name',
    '#default_value' => $link_configuration_storage
      ->id(),
    '#machine_name' => [
      'exists' => '\\Drupal\\menu_token\\Entity\\LinkConfigurationStorage::load',
    ],
    '#disabled' => !$link_configuration_storage
      ->isNew(),
  ];
  $form['linkid'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Link id'),
    '#maxlength' => 255,
    '#default_value' => $link_configuration_storage->linkid,
    '#description' => $this
      ->t("Link id for configuration storage"),
    '#required' => TRUE,
  ];
  $form['configurationSerialized'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('configurationSerialized'),
    '#maxlength' => 255,
    '#default_value' => $link_configuration_storage->configurationSerialized,
    '#description' => $this
      ->t("Serialized configuration"),
    '#required' => TRUE,
  ];
  return $form;
}