class LanguageContentSettingsTaxonomyVocabulary

Same name in this branch
  1. 9 core/modules/language/src/Plugin/migrate/source/d7/LanguageContentSettingsTaxonomyVocabulary.php \Drupal\language\Plugin\migrate\source\d7\LanguageContentSettingsTaxonomyVocabulary
Same name and namespace in other branches
  1. 10 core/modules/language/src/Plugin/migrate/source/d6/LanguageContentSettingsTaxonomyVocabulary.php \Drupal\language\Plugin\migrate\source\d6\LanguageContentSettingsTaxonomyVocabulary
  2. 10 core/modules/language/src/Plugin/migrate/source/d7/LanguageContentSettingsTaxonomyVocabulary.php \Drupal\language\Plugin\migrate\source\d7\LanguageContentSettingsTaxonomyVocabulary
  3. 11.x core/modules/language/src/Plugin/migrate/source/d6/LanguageContentSettingsTaxonomyVocabulary.php \Drupal\language\Plugin\migrate\source\d6\LanguageContentSettingsTaxonomyVocabulary
  4. 11.x core/modules/language/src/Plugin/migrate/source/d7/LanguageContentSettingsTaxonomyVocabulary.php \Drupal\language\Plugin\migrate\source\d7\LanguageContentSettingsTaxonomyVocabulary
  5. 8.9.x core/modules/language/src/Plugin/migrate/source/d6/LanguageContentSettingsTaxonomyVocabulary.php \Drupal\language\Plugin\migrate\source\d6\LanguageContentSettingsTaxonomyVocabulary
  6. 8.9.x core/modules/language/src/Plugin/migrate/source/d7/LanguageContentSettingsTaxonomyVocabulary.php \Drupal\language\Plugin\migrate\source\d7\LanguageContentSettingsTaxonomyVocabulary

Drupal 6 i18n vocabularies source from database.

For available configuration keys, refer to the parent classes.

Plugin annotation


@MigrateSource(
  id = "d6_language_content_settings_taxonomy_vocabulary",
  source_module = "taxonomy"
)

Hierarchy

Expanded class hierarchy of LanguageContentSettingsTaxonomyVocabulary

See also

\Drupal\migrate\Plugin\migrate\source\SqlBase

\Drupal\migrate\Plugin\migrate\source\SourcePluginBas

File

core/modules/language/src/Plugin/migrate/source/d6/LanguageContentSettingsTaxonomyVocabulary.php, line 21

Namespace

Drupal\language\Plugin\migrate\source\d6
View source
class LanguageContentSettingsTaxonomyVocabulary extends DrupalSqlBase {
  
  /**
   * {@inheritdoc}
   */
  public function query() {
    $query = $this->select('vocabulary', 'v')
      ->fields('v', [
      'vid',
    ]);
    if ($this->getDatabase()
      ->schema()
      ->fieldExists('vocabulary', 'language')) {
      $query->addField('v', 'language');
    }
    return $query;
  }
  
  /**
   * {@inheritdoc}
   */
  public function fields() {
    return [
      'vid' => $this->t('The vocabulary ID.'),
      'language' => $this->t('The default language for new terms.'),
      'state' => $this->t('The i18n taxonomy translation setting.'),
    ];
  }
  
  /**
   * {@inheritdoc}
   */
  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_vocabulary = $this->variableGet('i18ntaxonomy_vocabulary', []);
    $vid = $row->getSourceProperty('vid');
    $state = 0;
    if (array_key_exists($vid, $i18ntaxonomy_vocabulary)) {
      $state = $i18ntaxonomy_vocabulary[$vid];
    }
    $row->setSourceProperty('state', $state);
    return parent::prepareRow($row);
  }
  
  /**
   * {@inheritdoc}
   */
  public function getIds() {
    $ids['vid']['type'] = 'integer';
    return $ids;
  }

}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.