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