You are here

public function ContributorRoleForm::form in Bibliography & Citation 8

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

Class

ContributorRoleForm
Class ContributorRoleForm.

Namespace

Drupal\bibcite_entity\Form

Code

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