Sometimes, you've got a Drupal twig function that doesn't exist in PatternLab, and it prevents PatternLab from building.
You get this error:
PHP Fatal error: Uncaught Twig_Error_Syntax: Unknown "typogrify" filter in {code here}
What you need to do is create a Twig stub that does either what you need it to, or nothing at all. In emulsify, my twig functions exist at emulsify/components/_twig-components/filters
.
I am creating a typogrify
filter, and so I created a file called typogrify.filter.php
. It looks like this:
/** * @file * Add "typogrify" filter for Pattern Lab. */ $filter = new Twig_SimpleFilter('typogrify', function ($string) { return $string; });
You can do anything you like here with PHP. However, I only want PatternLab to compile, I don't actually need to do any fancy typogrify stuff. Therefore, this filter merely returns the string that was passed to it as an argument.
Mischief managed!