You are here

public function YamlFormEntityReferenceTrait::buildExportHeader in YAML Form 8

File

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

Class

YamlFormEntityReferenceTrait
Provides an 'entity_reference' trait.

Namespace

Drupal\yamlform\Plugin\YamlFormElement

Code

public function buildExportHeader(array $element, array $options) {
  if (!$this
    ->hasMultipleValues($element) && $options['entity_reference_format'] == 'link') {
    if ($options['header_format'] == 'label') {
      $header = [
        (string) $this
          ->t('ID'),
        (string) $this
          ->t('Title'),
        (string) $this
          ->t('URL'),
      ];
    }
    else {
      $header = [
        'id',
        'title',
        'url',
      ];
    }
    return $this
      ->prefixExportHeader($header, $element, $options);
  }
  else {
    return parent::buildExportHeader($element, $options);
  }
}