Skip to content

Multiple installations request for advice #217

Answered by xenocrat
eawmaas asked this question in Q&A
Discussion options

You must be logged in to vote

I think this would be a good use case for additional Twig functions defined by a module. Here's how it works: You create a basic module that has a few functions named like twig_function_<<your Twig function name>>, for example twig_function_render_family_tree().

Then in any Twig template, you can call the function {{ render_family_tree() }} to do some work and output any HTML you desire, or a filter {{ start_position | render_family_tree }} if you prefer. You can see exactly how this works by inspecting Leaf, Chyrp Lite's extension class. Functions and filters defined by a module would work just like the built-in functions mailto() and paginate(), or the filters thumbnail and translate - …

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
1 reply
@eawmaas
Comment options

Comment options

You must be logged in to vote
4 replies
@xenocrat
Comment options

@eawmaas
Comment options

@xenocrat
Comment options

Answer selected by eawmaas
@eawmaas
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants