You are here

public function ContributorCategoryForm::form in Bibliography & Citation 8

Same name and namespace in other branches
  1. 2.0.x modules/bibcite_entity/src/Form/ContributorCategoryForm.php \Drupal\bibcite_entity\Form\ContributorCategoryForm::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

modules/bibcite_entity/src/Form/ContributorCategoryForm.php, line 18

Class

ContributorCategoryForm
Class ContributorCategoryForm.

Namespace

Drupal\bibcite_entity\Form

Code

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