3 namespace Drupal\comment\Plugin\migrate\source\d6;
7 * id = "d6_comment_variable_per_comment_type"
10 class CommentVariablePerCommentType extends CommentVariable {
13 * Retrieves the values of the comment variables grouped by comment type.
17 protected function getCommentVariables() {
18 $node_types = parent::getCommentVariables();
19 // The return key used to separate comment types with hidden subject field.
21 foreach ($node_types as $node_type => $data) {
22 // Only 2 comment types depending on subject field visibility.
23 if (!empty($data['comment_subject_field'])) {
24 // Default label and description should be set in migration.
25 $return['comment'] = [
26 'comment_type' => 'comment',
27 'label' => $this->t('Default comments'),
28 'description' => $this->t('Allows commenting on content')
32 // Provide a special comment type with hidden subject field.
33 $return['comment_no_subject'] = [
34 'comment_type' => 'comment_no_subject',
35 'label' => $this->t('Comments without subject field'),
36 'description' => $this->t('Allows commenting on content, comments without subject field')
46 public function fields() {
48 'comment_type' => $this->t('The comment type'),
49 'label' => $this->t('The comment type label'),
50 'description' => $this->t('The comment type description'),
57 public function getIds() {
58 $ids['comment_type']['type'] = 'string';