Refactor twig extension; now the snippet is rendered from a template