mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 13:24:25 +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
|
$builder
|
||||||
->add('comment', TextareaType::class, [
|
->add('comment', TextareaType::class, [
|
||||||
'label' => false,
|
|
||||||
])
|
])
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -25,7 +25,6 @@ use Chill\MainBundle\Entity\User;
|
|||||||
use Chill\MainBundle\Repository\UserRepository;
|
use Chill\MainBundle\Repository\UserRepository;
|
||||||
use Chill\MainBundle\Templating\Entity\AbstractChillEntityRender;
|
use Chill\MainBundle\Templating\Entity\AbstractChillEntityRender;
|
||||||
|
|
||||||
|
|
||||||
class CommentRender extends AbstractChillEntityRender
|
class CommentRender extends AbstractChillEntityRender
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@ -48,24 +47,28 @@ class CommentRender extends AbstractChillEntityRender
|
|||||||
{
|
{
|
||||||
$username = '';
|
$username = '';
|
||||||
|
|
||||||
$user = $this->userRepository->find($entity->getUserId());
|
if ($entity->getUserId()) {
|
||||||
if ($user instanceof User) {
|
$user = $this->userRepository->find($entity->getUserId());
|
||||||
$username = $user->getUsername();
|
if ($user instanceof User) {
|
||||||
|
$username = $user->getUsername();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$str = $this->getDefaultOpeningBox('comment-embeddable').
|
$str = $this->getDefaultOpeningBox('comment-embeddable').
|
||||||
'<span class="comment_comment">'.
|
'<span class="comment_comment">'.
|
||||||
nl2br($entity->getComment()).
|
nl2br($entity->getComment()).
|
||||||
'</span>'.
|
|
||||||
'<span class="comment_date">'.
|
|
||||||
$entity->getDate()->format('d/m/Y h:i');
|
|
||||||
'</span>';
|
'</span>';
|
||||||
|
|
||||||
|
if ($entity->getDate() instanceof \DateTime) {
|
||||||
|
$str .= '<span class="comment_date">'.
|
||||||
|
$entity->getDate()->format('d/m/Y H:i');
|
||||||
|
'</span>';
|
||||||
|
}
|
||||||
|
|
||||||
if (strlen($username) > 0) {
|
if (strlen($username) > 0) {
|
||||||
$str .= '<span class="comment_user">'.
|
$str .= '<span class="comment_user">'.
|
||||||
$username.
|
$username.
|
||||||
'</span>'
|
'</span>';
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$str .= $this->getDefaultClosingBox();
|
$str .= $this->getDefaultClosingBox();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user