Adding isFlag method and Twig extension