You are here

public function ContentImport::getFields in Content Import 8

Same name and namespace in other branches
  1. 8.3 src/Form/ContentImport.php \Drupal\contentimport\Form\ContentImport::getFields()
  2. 8.4 src/Form/ContentImport.php \Drupal\contentimport\Form\ContentImport::getFields()

To get all Content Type Fields.

1 call to ContentImport::getFields()
ContentImport::createNode in src/Form/ContentImport.php
To import data as Content type nodes.

File

src/Form/ContentImport.php, line 90
Contains \Drupal\contentimport\Form\ContentImport.

Class

ContentImport
Configure Content Import settings for this site.

Namespace

Drupal\contentimport\Form

Code

public function getFields($contentType) {
  $entityManager = \Drupal::service('entity.manager');
  $fields = [];
  foreach (\Drupal::entityManager()
    ->getFieldDefinitions('node', $contentType) as $field_name => $field_definition) {
    if (!empty($field_definition
      ->getTargetBundle())) {
      $fields['name'][] = $field_definition
        ->getName();
      $fields['type'][] = $field_definition
        ->getType();
      $fields['setting'][] = $field_definition
        ->getSettings();
    }
  }
  return $fields;
}