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 @@ -636,6 +636,37 @@ serialize
636
636
Accepts any data that can be serialized by the :doc: `Serializer component </serializer >`
637
637
and returns a serialized string in the specified ``format ``.
638
638
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
+
639
670
.. _reference-twig-tags :
640
671
641
672
Tags
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::
607
607
$transliterator->transliterate('Menus with :green_salad: or :falafel:');
608
608
// => 'Menus with 🥗 or 🧆'
609
609
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
+
610
627
Removing Emojis
611
628
~~~~~~~~~~~~~~~
612
629
You can’t perform that action at this time.
0 commit comments