You are here

public static function MediaTarget::getFields in Media Feeds 8

Return value

FieldConfigInterface[]

1 call to MediaTarget::getFields()
MediaTarget::targets in src/Feeds/Target/MediaTarget.php
Returns the targets defined by this plugin.

File

src/Feeds/Target/MediaTarget.php, line 156

Class

MediaTarget
Defines a wrapper target around a paragraph bundle's target field.

Namespace

Drupal\media_feeds\Feeds\Target

Code

public static function getFields($entity_type, $bundle) {
  $fieldManager = \Drupal::service('entity_field.manager');
  $entityFields = $fieldManager
    ->getFieldDefinitions($entity_type, $bundle);
  $fields = array();
  foreach ($entityFields as $entityField) {
    if ($entityField instanceof FieldConfigInterface && $entityField
      ->getType() === 'entity_reference') {
      $fields[] = $entityField;
    }
  }
  return $fields;
}