You are here

protected function FieldTypeExportBase::getPropertyLabel in Entity Export CSV 8

Get the property header label.

Parameters

string $property_name: The property name.

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

Return value

mixed|string The property header label.

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

File

src/Plugin/FieldTypeExportBase.php, line 535

Class

FieldTypeExportBase
Base class for Field type export plugins.

Namespace

Drupal\entity_export_csv\Plugin

Code

protected function getPropertyLabel($property_name, FieldDefinitionInterface $field_definition) {
  $configuration = $this
    ->getConfiguration();
  $header_type = $configuration['header'];
  $properties = $this
    ->getPropertyExportOptions($field_definition);
  $header = '';
  if ($header_type === 'field_name') {
    $header = $property_name;
  }
  elseif ($header_type === 'label') {
    $header = isset($properties[$property_name]) ? $properties[$property_name] : $property_name;
  }
  return $header;
}