craft-preparse-field
craft-preparse-field copied to clipboard
Look into validating twig content in preparse field settings
From Andrew Welch:
Jalen, feel free to steal if it helps: https://github.com/nystudio107/craft-seomatic/blob/develop/src/validators/TwigExpressionValidator.php -- it renders the Twig code, and adds any errors to the model. You just add the TwigExpressionValidator to the model fields that need it: https://github.com/nystudio107/craft-seomatic/blob/develop/src/models/MetaScript.php#L188
Even better now: https://github.com/nystudio107/craft-twigfield#twig-template-validators