public function CourseEnrollmentTypeForm::form in Course 3.x
Same name and namespace in other branches
- 8.3 src/Form/CourseEnrollmentTypeForm.php \Drupal\course\Form\CourseEnrollmentTypeForm::form()
- 8.2 src/Form/CourseEnrollmentTypeForm.php \Drupal\course\Form\CourseEnrollmentTypeForm::form()
inheritdoc}
Overrides EntityForm::form
File
- src/
Form/ CourseEnrollmentTypeForm.php, line 14
Class
Namespace
Drupal\course\FormCode
public function form(array $form, FormStateInterface $form_state) {
$form = parent::form($form, $form_state);
$enrollment_type = $this->entity;
$form['label'] = [
'#title' => t('Label'),
'#type' => 'textfield',
'#default_value' => $enrollment_type
->label(),
'#description' => t('The admin-facing name.'),
'#required' => TRUE,
];
$form['id'] = [
'#type' => 'machine_name',
'#default_value' => $enrollment_type
->id(),
'#maxlength' => EntityTypeInterface::BUNDLE_MAX_LENGTH,
'#machine_name' => [
'exists' => '\\Drupal\\course\\Entity\\CourseEnrollmentType::load',
'source' => [
'label',
],
],
];
return $form;
}