You are here

public function MapperHelper::findParagraphsFields in Feeds Paragraphs 8

File

src/Utility/MapperHelper.php, line 43

Class

MapperHelper

Namespace

Drupal\feeds_para_mapper\Utility

Code

public function findParagraphsFields($entity_type, $bundle) {
  $fieldManager = \Drupal::service('entity_field.manager');
  $entityFields = $fieldManager
    ->getFieldDefinitions($entity_type, $bundle);
  $entityFields = array_filter($entityFields, function ($item) {
    return $item instanceof FieldConfigInterface;
  });
  $fields = array();
  foreach ($entityFields as $field) {
    if ($field
      ->getType() === 'entity_reference_revisions') {
      $fields[] = $field;
    }
  }
  return $fields;
}