W3cubDocs

/Twig 1

replace

The replace filter formats a given string by replacing the placeholders (placeholders are free-form):

{{ "I like %this% and %that%."|replace({'%this%': foo, '%that%': "bar"}) }}

{# outputs I like foo and bar
   if the foo parameter equals to the foo string. #}

Arguments

  • from: The placeholder values

© 2009–2017 by the Twig Team
Licensed under the three clause BSD license.
The Twig logo is © 2010–2017 SensioLabs
https://twig.sensiolabs.org/doc/1.x/filters/replace.html