You are here

public function YamlFormLikert::buildExportOptionsForm in YAML Form 8

Get an element's export options 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.

array $export_options: An associative array of default values.

Return value

array An associative array contain an element's export option form.

Overrides YamlFormElementBase::buildExportOptionsForm

File

src/Plugin/YamlFormElement/YamlFormLikert.php, line 201

Class

YamlFormLikert
Provides a 'likert' element.

Namespace

Drupal\yamlform\Plugin\YamlFormElement

Code

public function buildExportOptionsForm(array &$form, FormStateInterface $form_state, array $export_options) {
  $form['likert'] = [
    '#type' => 'details',
    '#title' => $this
      ->t('Likert questions and answers'),
    '#open' => TRUE,
    '#weight' => -10,
  ];
  $form['likert']['likert_answers_format'] = [
    '#type' => 'radios',
    '#title' => $this
      ->t('Answers format'),
    '#options' => [
      'label' => $this
        ->t('Answer labels, the human-readable value (label)'),
      'key' => $this
        ->t('Answer keys, the raw value stored in the database (key)'),
    ],
    '#default_value' => $export_options['likert_answers_format'],
  ];
}