You are here

public function WebformCompositeBase::buildExportOptionsForm in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/Plugin/WebformElement/WebformCompositeBase.php \Drupal\webform\Plugin\WebformElement\WebformCompositeBase::buildExportOptionsForm()

Get an element's export options webform.

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 webform.

Overrides WebformElementBase::buildExportOptionsForm

File

src/Plugin/WebformElement/WebformCompositeBase.php, line 729

Class

WebformCompositeBase
Provides a base for composite elements.

Namespace

Drupal\webform\Plugin\WebformElement

Code

public function buildExportOptionsForm(array &$form, FormStateInterface $form_state, array $export_options) {
  parent::buildExportOptionsForm($form, $form_state, $export_options);
  if (isset($form['composite'])) {
    return;
  }
  $form['composite'] = [
    '#type' => 'details',
    '#title' => $this
      ->t('Composite element options'),
    '#open' => TRUE,
    '#weight' => -10,
  ];
  $form['composite']['composite_element_item_format'] = [
    '#type' => 'radios',
    '#title' => $this
      ->t('Composite element item format'),
    '#options' => [
      'label' => $this
        ->t('Option labels, the human-readable value (label)'),
      'key' => $this
        ->t('Option values, the raw value stored in the database (key)'),
    ],
    '#default_value' => $export_options['composite_element_item_format'],
  ];
}