You are here

public function FieldTypeExportBase::getHeaderLabel in Entity Export CSV 8

Get the header label for a field.

Parameters

\Drupal\Core\Field\FieldDefinitionInterface $field_definition: The field definition.

Return value

string The header label.

Overrides FieldTypeExportInterface::getHeaderLabel

1 call to FieldTypeExportBase::getHeaderLabel()
FieldTypeExportBase::getHeaders in src/Plugin/FieldTypeExportBase.php
Get the header columns for a field.

File

src/Plugin/FieldTypeExportBase.php, line 511

Class

FieldTypeExportBase
Base class for Field type export plugins.

Namespace

Drupal\entity_export_csv\Plugin

Code

public function getHeaderLabel(FieldDefinitionInterface $field_definition) {
  $configuration = $this
    ->getConfiguration();
  $header_type = $configuration['header'];
  $header = '';
  if ($header_type === 'field_name') {
    $header = $field_definition
      ->getName();
  }
  elseif ($header_type === 'label') {
    $header = (string) $field_definition
      ->getLabel();
  }
  return $header;
}