protected function YamlFormOptionsForm::editForm in YAML Form 8
Edit form options source code form.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
array The form structure.
1 call to YamlFormOptionsForm::editForm()
- YamlFormOptionsForm::form in src/
YamlFormOptionsForm.php - Gets the actual form array to be built.
1 method overrides YamlFormOptionsForm::editForm()
- YamlFormUiOptionsForm::editForm in modules/
yamlform_ui/ src/ YamlFormUiOptionsForm.php - Edit form options source code form.
File
- src/
YamlFormOptionsForm.php, line 125
Class
- YamlFormOptionsForm
- Provides a form to set options.
Namespace
Drupal\yamlformCode
protected function editForm(array $form, FormStateInterface $form_state) {
$form['options'] = [
'#type' => 'yamlform_codemirror',
'#mode' => 'yaml',
'#title' => $this
->t('Options (YAML)'),
'#description' => $this
->t('Key-value pairs MUST be specified as "safe_key: \'Some readable option\'". Use of only alphanumeric characters and underscores is recommended in keys. One option per line. Option groups can be created by using just the group name followed by indented group options.'),
'#default_value' => Yaml::encode($this
->getOptions($form, $form_state)),
];
$form['#attached']['library'][] = 'yamlform/yamlform.codemirror.yaml';
return $form;
}