You are here

public function FormBase::form in Linkit 8.5

Same name and namespace in other branches
  1. 8.4 src/Form/Profile/FormBase.php \Drupal\linkit\Form\Profile\FormBase::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/Profile/FormBase.php, line 23

Class

FormBase
Base form for profile add and edit forms.

Namespace

Drupal\linkit\Form\Profile

Code

public function form(array $form, FormStateInterface $form_state) {
  $form['label'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Profile Name'),
    '#default_value' => $this->entity
      ->label(),
    '#description' => $this
      ->t('The human-readable name of this  profile. This name must be unique.'),
    '#required' => TRUE,
    '#size' => 30,
  ];
  $form['id'] = [
    '#type' => 'machine_name',
    '#default_value' => $this->entity
      ->id(),
    '#machine_name' => [
      'exists' => [
        '\\Drupal\\linkit\\Entity\\Profile',
        'load',
      ],
    ],
    '#disabled' => !$this->entity
      ->isNew(),
  ];
  $form['description'] = [
    '#type' => 'textarea',
    '#title' => $this
      ->t('Description'),
    '#default_value' => $this->entity
      ->getDescription(),
    '#description' => $this
      ->t('The text will be displayed on the <em>profile collection</em> page.'),
  ];
  $form['additional_settings'] = [
    '#type' => 'vertical_tabs',
    '#weight' => 99,
  ];
  return parent::form($form, $form_state);
}