You are here

public function Vocabulary::prepareRow in Drupal 10

Same name in this branch
  1. 10 core/modules/taxonomy/src/Plugin/migrate/source/d6/Vocabulary.php \Drupal\taxonomy\Plugin\migrate\source\d6\Vocabulary::prepareRow()
  2. 10 core/modules/taxonomy/src/Plugin/migrate/source/d7/Vocabulary.php \Drupal\taxonomy\Plugin\migrate\source\d7\Vocabulary::prepareRow()
Same name and namespace in other branches
  1. 8 core/modules/taxonomy/src/Plugin/migrate/source/d6/Vocabulary.php \Drupal\taxonomy\Plugin\migrate\source\d6\Vocabulary::prepareRow()
  2. 9 core/modules/taxonomy/src/Plugin/migrate/source/d6/Vocabulary.php \Drupal\taxonomy\Plugin\migrate\source\d6\Vocabulary::prepareRow()

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

1 method overrides Vocabulary::prepareRow()
VocabularyPerType::prepareRow in core/modules/taxonomy/src/Plugin/migrate/source/d6/VocabularyPerType.php
Adds additional data to the row.

File

core/modules/taxonomy/src/Plugin/migrate/source/d6/Vocabulary.php, line 68

Class

Vocabulary
Drupal 6 vocabularies source from database.

Namespace

Drupal\taxonomy\Plugin\migrate\source\d6

Code

public function prepareRow(Row $row) {

  // Find node types for this row.
  $node_types = $this
    ->select('vocabulary_node_types', 'nt')
    ->fields('nt', [
    'type',
    'vid',
  ])
    ->condition('vid', $row
    ->getSourceProperty('vid'))
    ->execute()
    ->fetchCol();
  $row
    ->setSourceProperty('node_types', $node_types);
  $row
    ->setSourceProperty('cardinality', $row
    ->getSourceProperty('tags') == 1 || $row
    ->getSourceProperty('multiple') == 1 ? FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED : 1);

  // If the vocabulary being migrated is the one defined in the
  // 'forum_nav_vocabulary' variable, set the 'forum_vocabulary' source
  // property to true so we know this is the vocabulary used by Forum.
  if ($this
    ->variableGet('forum_nav_vocabulary', 0) == $row
    ->getSourceProperty('vid')) {
    $row
      ->setSourceProperty('forum_vocabulary', TRUE);
  }
  return parent::prepareRow($row);
}