Security update for Core, with self-updated composer
[yaffs-website] / web / core / modules / language / src / Plugin / migrate / source / d6 / LanguageContentSettings.php
1 <?php
2
3 namespace Drupal\language\Plugin\migrate\source\d6;
4
5 use Drupal\migrate\Row;
6 use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
7
8 /**
9  * Drupal multilingual node settings from database.
10  *
11  * @MigrateSource(
12  *   id = "d6_language_content_settings",
13  *   source_module = "locale"
14  * )
15  */
16 class LanguageContentSettings extends DrupalSqlBase {
17
18   /**
19    * {@inheritdoc}
20    */
21   public function query() {
22     return $this->select('node_type', 't')
23       ->fields('t', [
24         'type',
25       ]);
26   }
27
28   /**
29    * {@inheritdoc}
30    */
31   public function fields() {
32     $fields = [
33       'type' => $this->t('Type'),
34       'language_content_type' => $this->t('Multilingual support.'),
35       'i18n_lock_node' => $this->t('Lock language.'),
36     ];
37     return $fields;
38   }
39
40   /**
41    * {@inheritdoc}
42    */
43   public function prepareRow(Row $row) {
44     $type = $row->getSourceProperty('type');
45     $row->setSourceProperty('language_content_type', $this->variableGet('language_content_type_' . $type, NULL));
46     $row->setSourceProperty('i18n_lock_node', $this->variableGet('i18n_lock_node_' . $type, 0));
47     return parent::prepareRow($row);
48   }
49
50   /**
51    * {@inheritdoc}
52    */
53   public function getIds() {
54     $ids['type']['type'] = 'string';
55     return $ids;
56   }
57
58 }