You are here

public function EckEntity::prepareRow in Entity Construction Kit (ECK) 8

Adds additional data to the row.

Parameters

\Drupal\migrate\Row $row: The row object.

Return value

bool FALSE if this row needs to be skipped.

Overrides SourcePluginBase::prepareRow

File

src/Plugin/migrate/source/d7/EckEntity.php, line 89

Class

EckEntity
Drupal 7 ECK Entity source from database.

Namespace

Drupal\eck\Plugin\migrate\source\d7

Code

public function prepareRow(Row $row) {
  $language = $row
    ->getSourceProperty('language');
  $id = $row
    ->getSourceProperty('id');
  $vid = $row
    ->hasSourceProperty('revision_id') ? $row
    ->getSourceProperty('revision_id') : $id;

  // Get Field API field values.
  foreach ($this
    ->getFields($this->entityType, $this->bundle) as $field_name => $field) {

    // Ensure we're using the right language if the entity is translatable.
    $field_language = $field['translatable'] ? $language : NULL;
    $row
      ->setSourceProperty($field_name, $this
      ->getFieldValues($this->entityType, $field_name, $id, $vid, $field_language));
  }
  return parent::prepareRow($row);
}