You are here

protected function FieldHelper::getFields in Feeds Paragraphs 8

1 call to FieldHelper::getFields()
FieldHelper::__construct in tests/src/Unit/Helpers/FieldHelper.php

File

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

Class

FieldHelper

Namespace

Drupal\Tests\feeds_para_mapper\Unit\Helpers

Code

protected function getFields() {

  // @todo: add multiple bundles field:
  $fields = array();
  $fieldsConfig = array(
    new FieldConfig('Paragraph field', 'paragraph_field', 'entity_reference_revisions', 1, 1, array(
      'handler_settings' => array(
        'target_bundles' => array(
          $this->bundles['bundle_one'],
        ),
      ),
    ), array(
      1,
    ), 'node', 'product', 'paragraph_field', 1),
    new FieldConfig('Bundle one bundle two', 'bundle_one_bundle_two', 'entity_reference_revisions', 2, -1, array(
      'handler_settings' => array(
        'target_bundles' => array(
          $this->bundles['bundle_two'],
        ),
      ),
    ), array(
      2,
    ), 'paragraph', 'bundle_one', 'bundle_one_bundle_two', 2),
    new FieldConfig('Bundle two text', 'bundle_two_text', 'text', 3, -1, array(
      'handler_settings' => array(),
    ), array(), 'paragraph', 'bundle_two', 'bundle_one_bundle_two', 3),
  );
  $this->fieldsConfig = $fieldsConfig;
  foreach ($fieldsConfig as $fieldConfig) {
    $field = $this
      ->getField($fieldConfig);
    $fields[] = $field;
  }
  return $fields;
}