php - Remove accent characters in twig -
please how can remove accent in variable url example téléphone telephone
<td><a href="{{ path('search_city',{'cityname':url }) }}">{{ city }}</a></td>
you can iconv
transliteration activated.
create filter with
$remove_accent = new twig_simplefilter('remove_accent', function ($string) { return iconv('utf-8', 'us-ascii//translit', $string); });
and add twig environment with
$twig = new twig_environment($loader); $twig->addfilter($remove_accent); // add
then call in twig file with
{{ city | remove_accent }}
Comments
Post a Comment