You are here

public function YamlFormEntityReferenceTrait::buildExportOptionsForm in YAML Form 8

File

src/Plugin/YamlFormElement/YamlFormEntityReferenceTrait.php, line 131

Class

YamlFormEntityReferenceTrait
Provides an 'entity_reference' trait.

Namespace

Drupal\yamlform\Plugin\YamlFormElement

Code

public function buildExportOptionsForm(array &$form, FormStateInterface $form_state, array $default_values) {
  if (isset($form['entity_reference'])) {
    return;
  }
  $form['entity_reference'] = [
    '#type' => 'details',
    '#title' => $this
      ->t('Entity reference options'),
    '#open' => TRUE,
  ];
  $form['entity_reference']['entity_reference_format'] = [
    '#type' => 'radios',
    '#title' => $this
      ->t('Entity reference format'),
    '#options' => [
      'link' => $this
        ->t('Entity link; with entity id, title and url in their own column.') . '<div class="description">' . $this
        ->t("Entity links are suitable as long as there are not too many submissions (ie 1000's) pointing to just a few unique entities (ie 100's).") . '</div>',
      'id' => $this
        ->t('Entity id; just the entity id column') . '<div class="description">' . $this
        ->t('Entity links are suitable as long as there is mechanism for the referenced entity to be looked up external (ie REST API).') . '</div>',
    ],
    '#default_value' => $default_values['entity_reference_format'],
  ];
}