public function WorkspaceTypeForm::form in Workspace 8
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/
Entity/ Form/ WorkspaceTypeForm.php, line 17
Class
- WorkspaceTypeForm
- Class WorkspaceTypeForm.
Namespace
Drupal\workspace\Entity\FormCode
public function form(array $form, FormStateInterface $form_state) {
$form = parent::form($form, $form_state);
$workspace_type = $this->entity;
$form['label'] = [
'#type' => 'textfield',
'#title' => $this
->t('Label'),
'#maxlength' => 255,
'#default_value' => $workspace_type
->label(),
'#description' => $this
->t("Label for the Workspace type."),
'#required' => TRUE,
];
$form['id'] = [
'#type' => 'machine_name',
'#default_value' => $workspace_type
->id(),
'#machine_name' => [
'exists' => '\\Drupal\\multiversion\\Entity\\WorkspaceType::load',
],
'#disabled' => !$workspace_type
->isNew(),
];
return $this
->protectBundleIdElement($form);
}