Create a free account to get access to additional free training videos. Enjoy this free video from CraftQuest! Create a free account to get access to additional free training videos. Join the Community
A brief review of what we'll create in this course.
In this course we’re going to build a Twig filter and a Twig function that will make it easy to “plantify” any text we pass in. Our task here is to satisfy a feature request to have the option to remove all instances of meat from some text.
(This is, of course, a little joke. It is in response to our friend Andrew Welch and the time he demonstrated the helpfulness of Typescript with an example that refused non-meat additions to an array of items on a virtual charcuterie board.
Let’s say the variable
text contains a paragraph of text with many instances of meat in it. We want to remove all mentions of meat and replace it with mentions of plants.
Okay, let’s get to building.