Closed bondjimbond closed 5 years ago
MIK uses Twig version 1 - is regex_replace new in version 2? All Twig version 1 filters/functions/etc should work.
As far as I know it's in both... not seeing anything in the changelog: https://github.com/twigphp/Twig/blob/2.x/CHANGELOG
Soooo... no idea why it's not recognizing my filter then?
Let me try it in a Templated parser to see if it works. Late today.
It's not listed at https://twig.symfony.com/doc/1.x/ or at https://twig.symfony.com/doc/2.x/ - where is it documented?
I think those two platforms provide regex_replace as a Twig extension. It doesn't appear to come as part of Twig itself.
MIK does provide an example of adding a custom extension, twigTruncate, at https://github.com/MarcusBarnes/mik/blob/master/src/utilities/MikTwigExtension.php.
... and I failed to add, we could implement our own regex_replace there if we wanted to.
No worries. Looks like I was able to get what I need out of a couple of other functions plus the "replace" function.
Cool. That said, if we want to extend Twig, we can do that.
[2018-08-29 18:17:47] ErrorException.ERROR: ErrorException {"message":"problem with metadataparser","record_key":669,"details":"[object] (Twig_Error_Syntax(code: 0): Unknown \"regex_replace\" filter. at /Users/brandon/sfuvault/mik/manipulations/athabasca_manipulations_nicknames/coordinates_herbarium.xml:4)"} []
My code:
Is there no regex_replace filter available, or did I just do a bad job writing it?