public function OpignoAnswerTypeForm::form in Opigno module 3.x
Same name and namespace in other branches
- 8 src/Form/OpignoAnswerTypeForm.php \Drupal\opigno_module\Form\OpignoAnswerTypeForm::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/
Form/ OpignoAnswerTypeForm.php, line 18
Class
- OpignoAnswerTypeForm
- Class OpignoAnswerTypeForm.
Namespace
Drupal\opigno_module\FormCode
public function form(array $form, FormStateInterface $form_state) {
$form = parent::form($form, $form_state);
$opigno_answer_type = $this->entity;
$form['label'] = [
'#type' => 'textfield',
'#title' => $this
->t('Label'),
'#maxlength' => 255,
'#default_value' => $opigno_answer_type
->label(),
'#description' => $this
->t("Label for the Answer type."),
'#required' => TRUE,
];
$form['id'] = [
'#type' => 'machine_name',
'#default_value' => $opigno_answer_type
->id(),
'#machine_name' => [
'exists' => '\\Drupal\\opigno_module\\Entity\\OpignoAnswerType::load',
],
'#disabled' => !$opigno_answer_type
->isNew(),
];
/* You will need additional form elements for your custom properties. */
return $form;
}