You are here

public function FieldablePanelsPaneEntityTranslation::prepareRow in Fieldable Panels Panes (FPP) 1.0.x

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/FieldablePanelsPaneEntityTranslation.php, line 50

Class

FieldablePanelsPaneEntityTranslation
Provides Drupal 7 node entity translations source plugin.

Namespace

Drupal\fieldable_panels_panes\Plugin\migrate\source\d7

Code

public function prepareRow(Row $row) {
  $fpid = $row
    ->getSourceProperty('entity_id');
  $vid = $row
    ->getSourceProperty('revision_id');
  $bundle = $row
    ->getSourceProperty('bundle');
  $language = $row
    ->getSourceProperty('language');

  // Get Field API field values.
  foreach ($this
    ->getFields('fieldable_panels_pane', $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('fieldable_panels_pane', $field_name, $fpid, $vid, $field_language));
  }

  // If the node title was replaced by a real field using the Drupal 7 Title
  // module, use the field value instead of the node title.
  if ($this
    ->moduleExists('title')) {
    $title_field = $row
      ->getSourceProperty('title_field');
    if (isset($title_field[0]['value'])) {
      $row
        ->setSourceProperty('title', $title_field[0]['value']);
    }
  }
  return parent::prepareRow($row);
}