File tree Expand file tree Collapse file tree 2 files changed +48
-0
lines changed Expand file tree Collapse file tree 2 files changed +48
-0
lines changed Original file line number Diff line number Diff line change @@ -645,6 +645,37 @@ serialize
645645Accepts any data that can be serialized by the :doc: `Serializer component </serializer >`
646646and returns a serialized string in the specified ``format ``.
647647
648+ .. _reference-twig-filter-emojify :
649+
650+ emojify
651+ ~~~~~~~
652+
653+ .. versionadded :: 7.1
654+
655+ The ``emojify `` filter was introduced in Symfony 7.1.
656+
657+ .. code-block :: twig
658+
659+ {{ text|emojify(catalog = null) }}
660+
661+ ``text ``
662+ **type **: ``string ``
663+
664+ ``catalog `` *(optional) *
665+ **type **: ``string `` | ``null ``
666+
667+ The emoji set used to generate the textual representation (``slack ``,
668+ ``github ``, ``gitlab ``, etc.)
669+
670+ It transforms the textual representation of an emoji (e.g. ``:wave: ``) into the
671+ actual emoji (π):
672+
673+ .. code-block :: twig
674+
675+ {{ ':+1:'|emojify }} {# renders: π #}
676+ {{ ':+1:'|emojify('github') }} {# renders: π #}
677+ {{ ':thumbsup:'|emojify('gitlab') }} {# renders: π #}
678+
648679 .. _reference-twig-tags :
649680
650681Tags
Original file line number Diff line number Diff line change @@ -637,6 +637,23 @@ You can convert emojis to short codes with the ``emoji-text`` locale::
637637 $transliterator->transliterate('Breakfast with π₯ or π₯');
638638 // => 'Breakfast with :kiwifruit: or :milk-glass:
639639
640+ Inverse Emoji Transliteration
641+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
642+
643+ .. versionadded :: 7.1
644+
645+ The inverse emoji transliteration was introduced in Symfony 7.1.
646+
647+ Given the textual representation of an emoji, you can reverse it back to get the
648+ actual emoji thanks to the :ref: `emojify filter <reference-twig-filter-emojify >`:
649+
650+ .. code-block :: twig
651+
652+ {{ 'green heart'|emojify }} {# renders: π #}
653+ {{ ':green_salad:'|emojify('slack') }} {# renders: π₯ #}
654+ {{ ':turtle:'|emojify('github') }} {# renders: π’ #}
655+ {{ ':kiwi:'|emojify('gitlab') }} {# renders: π₯ #}
656+
640657 Removing Emojis
641658~~~~~~~~~~~~~~~
642659
You canβt perform that action at this time.
0 commit comments