public function NoteTypeForm::form in Drupal PM (Project Management) 4.x
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/
pm_note/ src/ Form/ NoteTypeForm.php, line 18
Class
- NoteTypeForm
- Provides a form for editing a Note type.
Namespace
Drupal\pm_note\FormCode
public function form(array $form, FormStateInterface $form_state) {
$form = parent::form($form, $form_state);
$pm_note_type = $this->entity;
$form['label'] = [
'#type' => 'textfield',
'#title' => $this
->t('Label'),
'#maxlength' => 255,
'#default_value' => $pm_note_type
->label(),
'#description' => $this
->t("Label for the Note type."),
'#required' => TRUE,
];
$form['id'] = [
'#type' => 'machine_name',
'#default_value' => $pm_note_type
->id(),
'#machine_name' => [
'exists' => '\\Drupal\\pm_note\\Entity\\NoteType::load',
],
'#disabled' => !$pm_note_type
->isNew(),
];
/* You will need additional form elements for your custom properties. */
return $form;
}