public function YamlFormSubmissionNotesForm::form in YAML Form 8
Gets the actual form array to be built.
Overrides ContentEntityForm::form
See also
\Drupal\Core\Entity\EntityForm::processForm()
\Drupal\Core\Entity\EntityForm::afterBuild()
File
- src/
YamlFormSubmissionNotesForm.php, line 18
Class
- YamlFormSubmissionNotesForm
- Controller for form submission notes.
Namespace
Drupal\yamlformCode
public function form(array $form, FormStateInterface $form_state) {
/** @var \Drupal\yamlform\YamlFormRequestInterface $request_handler */
$request_handler = \Drupal::service('yamlform.request');
/** @var \Drupal\yamlform\YamlFormSubmissionInterface $yamlform_submission */
/** @var \Drupal\Core\Entity\EntityInterface $source_entity */
list($yamlform_submission, $source_entity) = $request_handler
->getYamlFormSubmissionEntities();
$form['navigation'] = [
'#theme' => 'yamlform_submission_navigation',
'#yamlform_submission' => $yamlform_submission,
'#access' => $this
->isModalDialog() ? FALSE : TRUE,
];
$form['information'] = [
'#theme' => 'yamlform_submission_information',
'#yamlform_submission' => $yamlform_submission,
'#source_entity' => $source_entity,
'#access' => $this
->isModalDialog() ? FALSE : TRUE,
];
$form['notes'] = [
'#type' => 'yamlform_codemirror',
'#title' => $this
->t('Administrative notes'),
'#description' => $this
->t('Enter notes about this submission. These notes are only visible to submission administrators.'),
'#default_value' => $yamlform_submission
->getNotes(),
];
$form['sticky'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Star/flag the status of this submission.'),
'#default_value' => $yamlform_submission
->isSticky(),
'#return_value' => TRUE,
'#access' => $this
->isModalDialog() ? FALSE : TRUE,
];
$form['#attached']['library'][] = 'yamlform/yamlform.admin';
return parent::form($form, $form_state);
}