// @see \Drupal\comment\CommentViewBuilder::buildComponents()
$thread =
$this->
getThread();
if (empty($thread)) { if ($this->threadLock
) { // Thread lock was not released after being set previously.
// This suggests there's a bug in code using this class.
throw new \
LogicException('preSave() is called again without calling postSave() or releaseThreadLock()'
);
} if (!
$this->
hasParentComment()) { // This is a comment with no parent comment (depth 0): we start
// by retrieving the maximum thread level.
$max =
$storage->
getMaxThread($this);
// Strip the "/" from the end of the thread.
$max =
rtrim((string) $max, '/'
);
// We need to get the value at the correct depth.
$parts =
explode('.',
$max);
$n = Number::
alphadecimalToInt($parts[0
]);
$prefix = '';
} else { // This is a comment with a parent comment, so increase the part of
// the thread value at the proper depth.