We create another Twig function but this time we pass in an array of words to use as replacements.
In this example, we’re going to manipulate text passed into the function using values passed into the function and then output.
Here’s how we’ll use it in our Twig template:
{{ plantify(['soy', 'beans', 'tofu', 'seitan', 'mushrooms', 'Beyond Burger', 'Tofurkey'], text) }}
Extending Twig in Craft CMS is made up of the following videos: