You are here

public function WebformEntityReferenceTrait::buildExportOptionsForm in Webform 8.5

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

File

src/Plugin/WebformElement/WebformEntityReferenceTrait.php, line 212

Class

WebformEntityReferenceTrait
Provides an 'entity_reference' trait.

Namespace

Drupal\webform\Plugin\WebformElement

Code

public function buildExportOptionsForm(array &$form, FormStateInterface $form_state, array $export_options) {
  if (isset($form['entity_reference'])) {
    return;
  }
  $form['entity_reference'] = [
    '#type' => 'details',
    '#title' => $this
      ->t('Entity reference options'),
    '#open' => TRUE,
  ];
  $form['entity_reference']['entity_reference_items'] = [
    '#type' => 'checkboxes',
    '#title' => $this
      ->t('Entity reference format'),
    '#options' => [
      'id' => $this
        ->t("ID, an entity's unique identified"),
      'title' => $this
        ->t("Title, an entity's title/label"),
      'url' => $this
        ->t("URL, an entity's URL"),
    ],
    '#required' => TRUE,
    '#default_value' => $export_options['entity_reference_items'],
    '#element_validate' => [
      [
        get_class($this),
        'validateEntityReferenceFormat',
      ],
    ],
  ];
}