File size: 841 Bytes
d2897cd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php

declare(strict_types=1);

namespace Mautic\CoreBundle\Twig\Extension;

use Mautic\CoreBundle\Helper\EmojiHelper;
use Twig\Extension\AbstractExtension;
use Twig\TwigFunction;

/**
 * @deprecated since Mautic 5.0, to be removed in 6.0 with no replacement.
 */
class EmojiExtension extends AbstractExtension
{
    public function __construct(
        protected EmojiHelper $emojiHelper
    ) {
    }

    public function getFunctions()
    {
        return [
            new TwigFunction('emoji_to_html', [$this, 'toHtml'], ['is_safe' => ['all']]),
        ];
    }

    /**
     * Convert to html.
     *
     * @deprecated since Mautic 5.0, to be removed in 6.0 with no replacement.
     */
    public function toHtml(string $text, string $from = 'emoji'): string
    {
        return $this->emojiHelper->toHtml($text, $from);
    }
}