8.5.x Term.php Term::prepareRow(Row $row)
8.5.x Term.php Term::prepareRow(Row $row)
8.5.x Term.php Term::prepareRow(Row $row)
8.0.x Term.php Term::prepareRow(Row $row)
8.1.x Term.php Term::prepareRow(Row $row)
8.2.x Term.php Term::prepareRow(Row $row)
8.2.x Term.php Term::prepareRow(Row $row)
8.2.x Term.php Term::prepareRow(Row $row)
8.3.x Term.php Term::prepareRow(Row $row)
8.3.x Term.php Term::prepareRow(Row $row)
8.3.x Term.php Term::prepareRow(Row $row)
8.4.x Term.php Term::prepareRow(Row $row)
8.4.x Term.php Term::prepareRow(Row $row)
8.4.x Term.php Term::prepareRow(Row $row)
8.6.x Term.php Term::prepareRow(Row $row)
8.6.x Term.php Term::prepareRow(Row $row)
8.6.x Term.php Term::prepareRow(Row $row)

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

core/modules/taxonomy/src/Plugin/migrate/source/d7/Term.php, line 58

Class

Term
Taxonomy term source from database.

Namespace

Drupal\taxonomy\Plugin\migrate\source\d7

Code

public function prepareRow(Row $row) {

  // Get Field API field values.
  foreach (array_keys($this
    ->getFields('taxonomy_term', $row
    ->getSourceProperty('machine_name'))) as $field) {
    $tid = $row
      ->getSourceProperty('tid');
    $row
      ->setSourceProperty($field, $this
      ->getFieldValues('taxonomy_term', $field, $tid));
  }

  // Find parents for this row.
  $parents = $this
    ->select('taxonomy_term_hierarchy', 'th')
    ->fields('th', [
    'parent',
    'tid',
  ])
    ->condition('tid', $row
    ->getSourceProperty('tid'))
    ->execute()
    ->fetchCol();
  $row
    ->setSourceProperty('parent', $parents);
  return parent::prepareRow($row);
}