Changed from deprecated method hookAddTwigExtension to addTwigExtension.