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; } }