created twig functions to generate category tree