You are here

private function CommentStyleguide::commentPrepare in Style Guide 8

Same name and namespace in other branches
  1. 2.x src/Plugin/Styleguide/CommentStyleguide.php \Drupal\styleguide\Plugin\Styleguide\CommentStyleguide::commentPrepare()

Helper method to prepare a fake comment.

Return value

array A renderable array.

1 call to CommentStyleguide::commentPrepare()
CommentStyleguide::items in src/Plugin/Styleguide/CommentStyleguide.php
Styleguide elements implementation.

File

src/Plugin/Styleguide/CommentStyleguide.php, line 91

Class

CommentStyleguide
Comment Styleguide items implementation.

Namespace

Drupal\styleguide\Plugin\Styleguide

Code

private function commentPrepare() {
  $comment = [
    'subject' => $this->generator
      ->words(5),
    'comment_type' => 'comment',
    'cid' => 0,
  ];
  return [
    '#theme' => 'comment',
    '#comment' => Comment::create($comment),
    '#comment_threaded' => TRUE,
    'content' => $this->generator
      ->paragraphs(),
  ];
}