mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Add CommentEmbeddable to Activity (Ref #21)
This commit is contained in:
parent
63dedb90f9
commit
354a202d06
@ -45,7 +45,7 @@ class CommentType extends AbstractType
|
||||
{
|
||||
$builder
|
||||
->add('comment', TextareaType::class, [
|
||||
'label' => false,
|
||||
|
||||
])
|
||||
;
|
||||
|
||||
|
@ -25,7 +25,6 @@ use Chill\MainBundle\Entity\User;
|
||||
use Chill\MainBundle\Repository\UserRepository;
|
||||
use Chill\MainBundle\Templating\Entity\AbstractChillEntityRender;
|
||||
|
||||
|
||||
class CommentRender extends AbstractChillEntityRender
|
||||
{
|
||||
/**
|
||||
@ -48,24 +47,28 @@ class CommentRender extends AbstractChillEntityRender
|
||||
{
|
||||
$username = '';
|
||||
|
||||
$user = $this->userRepository->find($entity->getUserId());
|
||||
if ($user instanceof User) {
|
||||
$username = $user->getUsername();
|
||||
if ($entity->getUserId()) {
|
||||
$user = $this->userRepository->find($entity->getUserId());
|
||||
if ($user instanceof User) {
|
||||
$username = $user->getUsername();
|
||||
}
|
||||
}
|
||||
|
||||
$str = $this->getDefaultOpeningBox('comment-embeddable').
|
||||
'<span class="comment_comment">'.
|
||||
nl2br($entity->getComment()).
|
||||
'</span>'.
|
||||
'<span class="comment_date">'.
|
||||
$entity->getDate()->format('d/m/Y h:i');
|
||||
'</span>';
|
||||
|
||||
if ($entity->getDate() instanceof \DateTime) {
|
||||
$str .= '<span class="comment_date">'.
|
||||
$entity->getDate()->format('d/m/Y H:i');
|
||||
'</span>';
|
||||
}
|
||||
|
||||
if (strlen($username) > 0) {
|
||||
$str .= '<span class="comment_user">'.
|
||||
$username.
|
||||
'</span>'
|
||||
;
|
||||
'</span>';
|
||||
}
|
||||
|
||||
$str .= $this->getDefaultClosingBox();
|
||||
|
Loading…
x
Reference in New Issue
Block a user