X-Git-Url: http://aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fnode%2Fsrc%2FPlugin%2Fmigrate%2Fsource%2Fd7%2FNodeType.php;h=e64b98908898650c84548acda5bd148114965d1b;hb=1c1cb0980bfa6caf0c24cce671b6bb541dc87583;hp=a0b2273b8071138d55645f1253aa1bf62305d8b2;hpb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;p=yaffs-website 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..e64b98908 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 { @@ -40,7 +40,7 @@ class NodeType extends DrupalSqlBase { * {@inheritdoc} */ public function fields() { - return [ + $fields = [ 'type' => $this->t('Machine name of the node type.'), 'name' => $this->t('Human name of the node type.'), 'description' => $this->t('Description of the node type.'), @@ -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); }