Version 1
[yaffs-website] / web / core / modules / language / src / Plugin / migrate / source / d6 / LanguageContentSettings.php
diff --git a/web/core/modules/language/src/Plugin/migrate/source/d6/LanguageContentSettings.php b/web/core/modules/language/src/Plugin/migrate/source/d6/LanguageContentSettings.php
new file mode 100644 (file)
index 0000000..ab9ba83
--- /dev/null
@@ -0,0 +1,57 @@
+<?php
+
+namespace Drupal\language\Plugin\migrate\source\d6;
+
+use Drupal\migrate\Row;
+use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
+
+/**
+ * Drupal multilingual node settings from database.
+ *
+ * @MigrateSource(
+ *   id = "d6_language_content_settings",
+ * )
+ */
+class LanguageContentSettings extends DrupalSqlBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function query() {
+    return $this->select('node_type', 't')
+      ->fields('t', [
+        'type',
+      ]);
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function fields() {
+    $fields = [
+      'type' => $this->t('Type'),
+      'language_content_type' => $this->t('Multilingual support.'),
+      'i18n_lock_node' => $this->t('Lock language.'),
+    ];
+    return $fields;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function prepareRow(Row $row) {
+    $type = $row->getSourceProperty('type');
+    $row->setSourceProperty('language_content_type', $this->variableGet('language_content_type_' . $type, NULL));
+    $row->setSourceProperty('i18n_lock_node', $this->variableGet('i18n_lock_node_' . $type, 0));
+    return parent::prepareRow($row);
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getIds() {
+    $ids['type']['type'] = 'string';
+    return $ids;
+  }
+
+}