You are here

protected function FieldTypeExportBase::getPropertiesSelected in Entity Export CSV 8

Get the field properties selected.

Parameters

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

Return value

array|mixed An array of properties selected.

2 calls to FieldTypeExportBase::getPropertiesSelected()
FieldTypeExportBase::export in src/Plugin/FieldTypeExportBase.php
Export the value of a field.
FieldTypeExportBase::getHeaders in src/Plugin/FieldTypeExportBase.php
Get the header columns for a field.

File

src/Plugin/FieldTypeExportBase.php, line 376

Class

FieldTypeExportBase
Base class for Field type export plugins.

Namespace

Drupal\entity_export_csv\Plugin

Code

protected function getPropertiesSelected(FieldDefinitionInterface $field_definition) {
  $configuration = $this
    ->getConfiguration();
  $property_names = !empty($configuration['property']) ? $configuration['property'] : [];
  if (empty($property_names)) {
    $storage = $field_definition
      ->getFieldStorageDefinition();
    $property_names = [
      $storage
        ->getMainPropertyName(),
    ];
  }

  // For backward compatibility, ensure the property is an array.
  if (!is_array($property_names)) {
    $property_names = [
      $property_names,
    ];
  }
  $property_names = array_filter($property_names);
  return $property_names;
}