public static function createEnvironment($paths, \Symfony\Component\Translation\Translator $translator, $options = array())
    {
        $viewPath = $paths['base'] . '/' . DIRNAME_VIEWS;
        $twigBridgePath = $paths['lib'] . '/symfony/twig-bridge/Symfony/Bridge/Twig';

        $opts = array();
        if (Config::get('app.twig_debug')) {
            $opts['debug'] = true;
        } elseif ($paths['cache']) {
            $opts['cache'] = $paths['cache'];
        }
        $opts = array_merge_recursive($opts, $options);
        $twig = new Twig_Environment(new Twig_Loader_Filesystem(
            array(
                $twigBridgePath . '/Resources/views/Form',
            )
        ), $opts);

        if (is_object($translator)) {
            $twig->addExtension(
                new \Symfony\Bridge\Twig\Extension\TranslationExtension(
                    $translator
                )
            );
        }

        $twig->addExtension(
            new Concrete5Extension()
        );

        if (Config::get('app.package_dev_mode')) {
            $twig->addExtension(new Twig_Extension_Debug());
        }

        return $twig;
    }