add level calculation

This commit is contained in:
Thorsten Witteler 2017-10-19 23:06:47 +02:00
parent 018a42a3dc
commit 6d458f8fa4
2 changed files with 10 additions and 13 deletions

View file

@ -1,5 +1,7 @@
<?php
namespace Grav\Plugin;
class Comment
{
private $id = 0;
@ -22,11 +24,11 @@ class Comment
}
public function getContent($level = 0) {
$comments = $this->value;
$comments['level'] = $level;
$this->value['level'] = $level;
$comments[] = $this->value;
foreach($this->children as $child) {
array_merge($comments, $child->getContent($level + 1));
$comments[] = $child->getContent($level + 1);
}
return $comments;
}