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 @@ -636,6 +636,37 @@ serialize
636636Accepts any data that can be serialized by the :doc: `Serializer component </serializer >`
637637and returns a serialized string in the specified ``format ``.
638638
639+ .. _reference-twig-filter-emojify :
640+
641+ emojify
642+ ~~~~~~~
643+
644+ .. versionadded :: 7.1
645+
646+ The ``emojify `` filter was introduced in Symfony 7.1.
647+
648+ .. code-block :: twig
649+
650+ {{ text|emojify(catalog = null) }}
651+
652+ ``text ``
653+ **type **: ``string ``
654+
655+ ``catalog `` *(optional) *
656+ **type **: ``string `` | ``null ``
657+
658+ The emoji set used to generate the textual representation (``slack ``,
659+ ``github ``, ``gitlab ``, etc.)
660+
661+ It transforms the textual representation of an emoji (e.g. ``:wave: ``) into the
662+ actual emoji (π):
663+
664+ .. code-block :: twig
665+
666+ {{ ':+1:'|emojify }} {# renders: π #}
667+ {{ ':+1:'|emojify('github') }} {# renders: π #}
668+ {{ ':thumbsup:'|emojify('gitlab') }} {# renders: π #}
669+
639670 .. _reference-twig-tags :
640671
641672Tags
Original file line number Diff line number Diff line change @@ -607,6 +607,23 @@ Convert Slack short codes to emojis with the ``slack-emoji`` locale::
607607 $transliterator->transliterate('Menus with :green_salad: or :falafel:');
608608 // => 'Menus with π₯ or π§'
609609
610+ Inverse Emoji Transliteration
611+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
612+
613+ .. versionadded :: 7.1
614+
615+ The inverse emoji transliteration was introduced in Symfony 7.1.
616+
617+ Given the textual representation of an emoji, you can reverse it back to get the
618+ actual emoji thanks to the :ref: `emojify filter <reference-twig-filter-emojify >`:
619+
620+ .. code-block :: twig
621+
622+ {{ 'green heart'|emojify }} {# renders: π #}
623+ {{ ':green_salad:'|emojify('slack') }} {# renders: π₯ #}
624+ {{ ':turtle:'|emojify('github') }} {# renders: π’ #}
625+ {{ ':kiwi:'|emojify('gitlab') }} {# renders: π₯ #}
626+
610627 Removing Emojis
611628~~~~~~~~~~~~~~~
612629
You canβt perform that action at this time.
0 commit comments