Twig extension to make conditional layout and to inject variables in templates