You are here

protected function WebformOptionsForm::editForm in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/WebformOptionsForm.php \Drupal\webform\WebformOptionsForm::editForm()

Edit webform 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 WebformOptionsForm::editForm()
WebformOptionsForm::form in src/WebformOptionsForm.php
Gets the actual form array to be built.
1 method overrides WebformOptionsForm::editForm()
WebformUiOptionsForm::editForm in modules/webform_ui/src/WebformUiOptionsForm.php
Edit webform options source code form.

File

src/WebformOptionsForm.php, line 202

Class

WebformOptionsForm
Provides a form to set options.

Namespace

Drupal\webform

Code

protected function editForm(array $form, FormStateInterface $form_state) {
  $form['options'] = [
    '#type' => 'webform_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.') . ' ' . $this
      ->t("Descriptions, which are only applicable to radios and checkboxes, can be delimited using ' -- '."),
    '#attributes' => [
      'style' => 'min-height: 200px',
    ],
    '#default_value' => Yaml::encode($this
      ->getOptions()),
  ];
  return $form;
}