You are here

public function VocabularyPerType::prepareRow in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/taxonomy/src/Plugin/migrate/source/d6/VocabularyPerType.php \Drupal\taxonomy\Plugin\migrate\source\d6\VocabularyPerType::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 Vocabulary::prepareRow

File

core/modules/taxonomy/src/Plugin/migrate/source/d6/VocabularyPerType.php, line 35

Class

VocabularyPerType
Drupal 6 vocabularies with associated node types source from database.

Namespace

Drupal\taxonomy\Plugin\migrate\source\d6

Code

public function prepareRow(Row $row) {

  // Get the i18n taxonomy translation setting for this vocabulary.
  // 0 - No multilingual options
  // 1 - Localizable terms. Run through the localization system.
  // 2 - Predefined language for a vocabulary and its terms.
  // 3 - Per-language terms, translatable (referencing terms with different
  // languages) but not localizable.
  $i18ntaxonomy_vocab = $this
    ->variableGet('i18ntaxonomy_vocabulary', []);
  $vid = $row
    ->getSourceProperty('vid');
  $i18ntaxonomy_vocabulary = FALSE;
  if (array_key_exists($vid, $i18ntaxonomy_vocab)) {
    $i18ntaxonomy_vocabulary = $i18ntaxonomy_vocab[$vid];
  }
  $row
    ->setSourceProperty('i18ntaxonomy_vocabulary', $i18ntaxonomy_vocabulary);
  return parent::prepareRow($row);
}