public function QuizResultTypeForm::form in Quiz 8.5
Same name and namespace in other branches
- 8.6 src/Entity/QuizResultTypeForm.php \Drupal\quiz\Entity\QuizResultTypeForm::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/
Entity/ QuizResultTypeForm.php, line 14
Class
Namespace
Drupal\quiz\EntityCode
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\\quiz\\Entity\\QuizResultType::load',
'source' => [
'label',
],
],
];
return $form;
}