mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
remove privateCommentRender
This commit is contained in:
parent
1b6e84262b
commit
3122098447
@ -1,72 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Chill is a software for social workers
|
|
||||||
*
|
|
||||||
* For the full copyright and license information, please view
|
|
||||||
* the LICENSE file that was distributed with this source code.
|
|
||||||
*/
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace Chill\MainBundle\Templating\Entity;
|
|
||||||
|
|
||||||
use Chill\MainBundle\Entity\Embeddable\PrivateCommentEmbeddable;
|
|
||||||
use Symfony\Component\Security\Core\Security;
|
|
||||||
use Symfony\Component\Templating\EngineInterface;
|
|
||||||
|
|
||||||
use function array_merge;
|
|
||||||
|
|
||||||
class PrivateCommentRender extends AbstractChillEntityRender
|
|
||||||
{
|
|
||||||
private EngineInterface $engine;
|
|
||||||
|
|
||||||
private Security $security;
|
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
EngineInterface $engine,
|
|
||||||
Security $security
|
|
||||||
) {
|
|
||||||
$this->engine = $engine;
|
|
||||||
$this->sercurity = $security;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param PrivateCommentEmbeddable $entity
|
|
||||||
*/
|
|
||||||
public function renderBox($entity, array $options): string
|
|
||||||
{
|
|
||||||
// default options
|
|
||||||
$options = array_merge([
|
|
||||||
'user' => [],
|
|
||||||
'disable_markdown' => false,
|
|
||||||
'limit_lines' => null,
|
|
||||||
'metadata' => true,
|
|
||||||
], $options);
|
|
||||||
|
|
||||||
return $this->engine
|
|
||||||
->render(
|
|
||||||
'@ChillMain/Entity/CommentEmbeddable.html.twig',
|
|
||||||
[
|
|
||||||
'opening_box' => $this->getDefaultOpeningBox('comment-embeddable'),
|
|
||||||
'closing_box' => $this->getDefaultClosingBox(),
|
|
||||||
'user' => $this->security->getUser() ?? null,
|
|
||||||
'comment' => $entity->getCommentForUser($this->security->getUser()),
|
|
||||||
'options' => $options,
|
|
||||||
]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param PrivateCommentEmbeddable $entity
|
|
||||||
*/
|
|
||||||
public function renderString($entity, array $options): string
|
|
||||||
{
|
|
||||||
return $entity->getCommentForUser($this->security->getUser());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function supports($entity, array $options): bool
|
|
||||||
{
|
|
||||||
return $entity instanceof PrivateCommentEmbeddable;
|
|
||||||
}
|
|
||||||
}
|
|
@ -41,10 +41,6 @@ services:
|
|||||||
tags:
|
tags:
|
||||||
- { name: 'chill.render_entity' }
|
- { name: 'chill.render_entity' }
|
||||||
|
|
||||||
Chill\MainBundle\Templating\Entity\PrivateCommentRender:
|
|
||||||
tags:
|
|
||||||
- { name: 'chill.render_entity' }
|
|
||||||
|
|
||||||
Chill\MainBundle\Templating\ChillMarkdownRenderExtension:
|
Chill\MainBundle\Templating\ChillMarkdownRenderExtension:
|
||||||
tags:
|
tags:
|
||||||
- { name: twig.extension }
|
- { name: twig.extension }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user