You are here

protected function FeedsParaMapperWebTestCase::getTopHostParagraphsEntities in Feeds Paragraphs 7

Gets the paragraphs items attached to the created node.

Return value

array The attached items array.

5 calls to FeedsParaMapperWebTestCase::getTopHostParagraphsEntities()
FeedsParaMapperNestedImportTestCase::testNestedImport in tests/importing.test
Test importing nodes with nested paragraphs fields.
FeedsParaMapperSingleValueTestCase::checkFileFieldImport in tests/importing.test
Test importing nodes with image field in a Paragraphs bundle.
FeedsParaMapperSingleValueTestCase::testImport in tests/importing.test
Test importing nodes with paragraphs field value.
FeedsParaMapperWebTestCase::multiImport in tests/FeedsParaMapperWebTestCase.test
Tests Multi-valued fields importing.
FeedsParaMapperWebTestCase::topHostParagraphsEntityExists in tests/FeedsParaMapperWebTestCase.test
Check whether the top host (node) has Paragraphs entity.

File

tests/FeedsParaMapperWebTestCase.test, line 451
Common functionality for all Paragraphs Mapper tests.

Class

FeedsParaMapperWebTestCase
Test basic functionality via DrupalWebTestCase.

Code

protected function getTopHostParagraphsEntities() {
  $node = node_load(1);
  $lang = $node->language;
  $host_field = 'field_' . $this->paragraphField;
  $items = array();
  foreach ($node->{$host_field}[$lang] as $val) {
    $id = array(
      $val['value'],
    );
    $item = entity_load('paragraphs_item', $id, array(), TRUE);
    $item = reset($item);
    $items[] = $item;
  }
  return $items;
}