You are here

public function FieldHelper::getFieldDefinitions in Feeds Paragraphs 8

File

tests/src/Unit/Helpers/FieldHelper.php, line 163

Class

FieldHelper

Namespace

Drupal\Tests\feeds_para_mapper\Unit\Helpers

Code

public function getFieldDefinitions($entity_type, $bundle) {
  $result = null;
  switch ($entity_type) {
    case "paragraph":
      $result = $this
        ->getBundleFields($bundle);
      break;
    case "node":
      $result = array(
        $this->fields[0],
      );
      break;
  }
  if (isset($result)) {
    $fields = array();
    foreach ($result as $field) {
      $name = $field
        ->reveal()
        ->getName();
      $fields[$name] = $field;
    }
    return $fields;
  }
  return null;
}