You are here

protected function CommentVariablePerCommentType::getCommentVariables in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/comment/src/Plugin/migrate/source/d6/CommentVariablePerCommentType.php \Drupal\comment\Plugin\migrate\source\d6\CommentVariablePerCommentType::getCommentVariables()

Retrieves the values of the comment variables grouped by comment type.

Return value

array

Overrides CommentVariable::getCommentVariables

File

core/modules/comment/src/Plugin/migrate/source/d6/CommentVariablePerCommentType.php, line 22
Contains \Drupal\comment\Plugin\migrate\source\d6\CommentVariablePerCommentType.

Class

CommentVariablePerCommentType
Plugin annotation @MigrateSource( id = "d6_comment_variable_per_comment_type" )

Namespace

Drupal\comment\Plugin\migrate\source\d6

Code

protected function getCommentVariables() {
  $node_types = parent::getCommentVariables();

  // The return key used to separate comment types with hidden subject field.
  $return = array();
  foreach ($node_types as $node_type => $data) {

    // Only 2 comment types depending on subject field visibility.
    if (empty($data['comment_subject_field'])) {

      // Default label and description should be set in migration.
      $return['comment'] = array(
        'comment_type' => 'comment',
        'label' => $this
          ->t('Default comments'),
        'description' => $this
          ->t('Allows commenting on content'),
      );
    }
    else {

      // Provide a special comment type with hidden subject field.
      $return['comment_no_subject'] = array(
        'comment_type' => 'comment_no_subject',
        'label' => $this
          ->t('Comments without subject field'),
        'description' => $this
          ->t('Allows commenting on content, comments without subject field'),
      );
    }
  }
  return $return;
}