You are here

function ContentExportController::getValidFieldList in Content Export CSV 8

* Gets Valid Field List

1 call to ContentExportController::getValidFieldList()
ContentExportController::getNodeData in src/Controller/ContentExportController.php
* Gets Manipulated Node Data

File

src/Controller/ContentExportController.php, line 46

Class

ContentExportController

Namespace

Drupal\content_export_csv\Controller

Code

function getValidFieldList($nodeType) {
  $nodeArticleFields = \Drupal::entityManager()
    ->getFieldDefinitions('node', $nodeType);
  $nodeFields = array_keys($nodeArticleFields);
  $unwantedFields = array(
    'comment',
    'sticky',
    'revision_default',
    'revision_translation_affected',
    'revision_timestamp',
    'revision_uid',
    'revision_log',
    'vid',
    'uuid',
    'promote',
  );
  foreach ($unwantedFields as $unwantedField) {
    $unwantedFieldKey = array_search($unwantedField, $nodeFields);
    unset($nodeFields[$unwantedFieldKey]);
  }
  return $nodeFields;
}