You are here

public function FlaggingCollectionTypeForm::form in Flag Lists 4.0.x

Same name and namespace in other branches
  1. 8 src/Form/FlaggingCollectionTypeForm.php \Drupal\flag_lists\Form\FlaggingCollectionTypeForm::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/FlaggingCollectionTypeForm.php, line 16

Class

FlaggingCollectionTypeForm
Form for setting Flagging Collection Type properties.

Namespace

Drupal\flag_lists\Form

Code

public function form(array $form, FormStateInterface $form_state) {
  $form = parent::form($form, $form_state);
  $flagging_collection_type = $this->entity;
  $form['label'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Label'),
    '#maxlength' => 255,
    '#default_value' => $flagging_collection_type
      ->label(),
    '#description' => $this
      ->t("Label for the Flagging collection type."),
    '#required' => TRUE,
  ];
  $form['id'] = [
    '#type' => 'machine_name',
    '#default_value' => $flagging_collection_type
      ->id(),
    '#machine_name' => [
      'exists' => '\\Drupal\\flag_lists\\Entity\\FlaggingCollectionType::load',
    ],
    '#disabled' => !$flagging_collection_type
      ->isNew(),
  ];

  /* You will need additional form elements for your custom properties. */
  return $form;
}