Last active
February 22, 2022 04:07
-
-
Save thomasthesecond/1a5e28e14a25e31e8d33 to your computer and use it in GitHub Desktop.
Twig filter for formatting telephone numbers for anchors
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+1-{{ phoneNumber|trim|replace({'(': '', ')': '', ' ': '-', '.': '-'}) }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nicely done -- but was looking for one to go in the opposite direction, and I'm surprised not to find one. Maybe it's just too easy to write your own custom twig filter, especially in Symfony apps. So, https://gist.github.com/davidmintz/8b532e1a1387bdf2c8b8769c997fdd9b