3 namespace Drupal\comment\Plugin\migrate\source\d6;
5 @trigger_error('CommentVariablePerCommentType is deprecated in Drupal 8.4.x and will be removed before Drupal 9.0.x. Use \Drupal\node\Plugin\migrate\source\d6\NodeType instead.', E_USER_DEPRECATED);
9 * id = "d6_comment_variable_per_comment_type",
10 * source_module = "comment"
13 * @deprecated in Drupal 8.4.x, to be removed before Drupal 9.0.x. Use
14 * \Drupal\node\Plugin\migrate\source\d6\NodeType instead.
16 class CommentVariablePerCommentType extends CommentVariable {
19 * Retrieves the values of the comment variables grouped by comment type.
23 protected function getCommentVariables() {
24 $node_types = parent::getCommentVariables();
25 // The return key used to separate comment types with hidden subject field.
27 foreach ($node_types as $node_type => $data) {
28 // Only 2 comment types depending on subject field visibility.
29 if (!empty($data['comment_subject_field'])) {
30 // Default label and description should be set in migration.
31 $return['comment'] = [
32 'comment_type' => 'comment',
33 'label' => $this->t('Default comments'),
34 'description' => $this->t('Allows commenting on content')
38 // Provide a special comment type with hidden subject field.
39 $return['comment_no_subject'] = [
40 'comment_type' => 'comment_no_subject',
41 'label' => $this->t('Comments without subject field'),
42 'description' => $this->t('Allows commenting on content, comments without subject field')
52 public function fields() {
54 'comment_type' => $this->t('The comment type'),
55 'label' => $this->t('The comment type label'),
56 'description' => $this->t('The comment type description'),
63 public function getIds() {
64 $ids['comment_type']['type'] = 'string';