File tree 2 files changed +48
-0
lines changed
2 files changed +48
-0
lines changed Original file line number Diff line number Diff line change @@ -645,6 +645,37 @@ serialize
645
645
Accepts any data that can be serialized by the :doc: `Serializer component </serializer >`
646
646
and returns a serialized string in the specified ``format ``.
647
647
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
+
648
679
.. _reference-twig-tags :
649
680
650
681
Tags
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::
637
637
$transliterator->transliterate('Breakfast with 🥝 or 🥛');
638
638
// => 'Breakfast with :kiwifruit: or :milk-glass:
639
639
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
+
640
657
Removing Emojis
641
658
~~~~~~~~~~~~~~~
642
659
You can’t perform that action at this time.
0 commit comments