frctl / twig

Use Twig templates with Fractal.
32 stars 34 forks source link

Does not work for documentation entities #19

Closed Chapabu closed 4 years ago

Chapabu commented 5 years ago

If you have the docs engine set to Twig, you only ever get an error saying entity.variants is not a function. I've tracked this down to line 68 in adapter.js.

entity = entity.isVariant ? entity : entity.variants().default();

A document is not a variant, so the second part is called. but variants() is not a method on a document object.

Just needs an if (entity.isDoc) wrapping around that somewhere so we don't hit that second part for documents.

Chapabu commented 5 years ago

I'll try and get onto this tomorrow.