You are here

protected function FieldCollectionEntityTranslationTestCase::getFieldValues in Field collection 7

Returns the text field values of an specified node, language and delta.

Parameters

mixed $node:

string $langcode:

int $delta:

Return value

array

1 call to FieldCollectionEntityTranslationTestCase::getFieldValues()
FieldCollectionEntityTranslationTestCase::testEntityTranslation in ./field_collection.test
Ensures the right behaviour in all Entity Translation use cases.

File

./field_collection.test, line 1162
Tests for field_collections.

Class

FieldCollectionEntityTranslationTestCase
Test using field collection with content that gets translated with Entity Translation.

Code

protected function getFieldValues($node, $langcode, $delta) {
  $return = array();
  if (isset($node->{$this->field_name}[$langcode][$delta]['value'])) {
    $fc_item_id = $node->{$this->field_name}[$langcode][$delta]['value'];

    // Load the field collection.
    $fc_item_array = entity_load('field_collection_item', array(
      $fc_item_id,
    ));
    $fc_item = reset($fc_item_array);
    $return = array(
      'field_untrans' => $fc_item->{$this->field_untrans_name}[LANGUAGE_NONE][0]['value'],
      'field_trans' => $fc_item->{$this->field_trans_name}[$langcode][0]['value'],
    );
  }
  return $return;
}