X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fnode%2Fsrc%2FPlugin%2Fmigrate%2Fsource%2Fd7%2FNodeType.php;fp=web%2Fcore%2Fmodules%2Fnode%2Fsrc%2FPlugin%2Fmigrate%2Fsource%2Fd7%2FNodeType.php;h=44f0b5e06031f8ec9cdc80b387117c6ed47c70e9;hp=a0b2273b8071138d55645f1253aa1bf62305d8b2;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hpb=aea91e65e895364e460983b890e295aa5d5540a5 diff --git a/web/core/modules/node/src/Plugin/migrate/source/d7/NodeType.php b/web/core/modules/node/src/Plugin/migrate/source/d7/NodeType.php index a0b2273b8..44f0b5e06 100644 --- a/web/core/modules/node/src/Plugin/migrate/source/d7/NodeType.php +++ b/web/core/modules/node/src/Plugin/migrate/source/d7/NodeType.php @@ -10,7 +10,7 @@ use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase; * * @MigrateSource( * id = "d7_node_type", - * source_provider = "node" + * source_module = "node" * ) */ class NodeType extends DrupalSqlBase { @@ -54,6 +54,28 @@ class NodeType extends DrupalSqlBase { 'orig_type' => $this->t('The original type.'), 'teaser_length' => $this->t('Teaser length'), ]; + if ($this->moduleExists('comment')) { + $fields += $this->getCommentFields(); + } + return $fields; + } + + /** + * Returns the fields containing comment settings for each node type. + * + * @return string[] + * An associative array of field descriptions, keyed by field. + */ + protected function getCommentFields() { + return [ + 'comment' => $this->t('Default comment setting'), + 'comment_default_mode' => $this->t('Default display mode'), + 'comment_default_per_page' => $this->t('Default comments per page'), + 'comment_anonymous' => $this->t('Anonymous commenting'), + 'comment_subject_field' => $this->t('Comment subject field'), + 'comment_preview' => $this->t('Preview comment'), + 'comment_form_location' => $this->t('Location of comment submission form'), + ]; } /** @@ -107,6 +129,13 @@ class NodeType extends DrupalSqlBase { if ($parent = $this->variableGet('menu_parent_' . $type, NULL)) { $row->setSourceProperty('parent', $parent . ':'); } + + if ($this->moduleExists('comment')) { + foreach (array_keys($this->getCommentFields()) as $field) { + $row->setSourceProperty($field, $this->variableGet($field . '_' . $type, NULL)); + } + } + return parent::prepareRow($row); }