[FR] Add support for custom tests in Twig
Closed this issue · 0 comments
rungta commented
Twig allows custom test operators to be defined which is leveraged by Craft CMS to include tests like instance of
.
Would be great to have support for declaring these as an option similar to twigMultiTags
.
Stack Trace
templates/_routers/collective.twig
[error] templates/_routers/collective.twig: Error: ERROR: Unknown test "instance of"
[error] 3 | #}
[error] 4 |
[error] > 5 | {%- extends (element is instance of ('craft\\elements\\Category') ? [
[error] | ^
[error] 6 | '_views/collectives/' ~ element.group.handle,
[error] 7 | ] : [
[error] at TokenStream.error (file:///.../node_modules/@zackad/prettier-plugin-twig/src/melody/melody-parser/TokenStream.js:129:24)
[error] at Parser.error (file:///.../node_modules/@zackad/prettier-plugin-twig/src/melody/melody-parser/Parser.js:452:21)
[error] at getTest (file:///.../node_modules/@zackad/prettier-plugin-twig/src/melody/melody-extension-core/operators.js:258:20)
[error] at Object.parse (file:///.../node_modules/@zackad/prettier-plugin-twig/src/melody/melody-extension-core/operators.js:226:22)
[error] at Parser.matchExpression (file:///.../node_modules/@zackad/prettier-plugin-twig/src/melody/melody-parser/Parser.js:532:27)
[error] at Parser.getPrimary (file:///.../node_modules/@zackad/prettier-plugin-twig/src/melody/melody-parser/Parser.js:577:31)