src/Sulu/Component/Webspace/StructureProvider/WebspaceStructureProvider.php
protected function templateExists($template)
    {
        $loader = $this->twig->getLoader();
        if (method_exists($loader, 'exists')) {
            return $loader->exists($template);
        }

        try {
            // cast possible TemplateReferenceInterface to string because the
            // EngineInterface supports them but Twig_LoaderInterface does not
            $loader->getSource($template)->getCode();
        } catch (\Twig_Error_Loader $e) {
            return false;
        }

        return true;
    }
protected function templateExists($template)
    {
        $loader = $this->twig->getLoader();
        if (method_exists($loader, 'exists')) {
            return $loader->exists($template);
        }

        try {
            // cast possible TemplateReferenceInterface to string because the
            // EngineInterface supports them but Twig_LoaderInterface does not
            $loader->getSource($template)->getCode();
        } catch (\Twig_Error_Loader $e) {
            return false;
        }

        return true;
    }
protected function templateExists ( $ template ) { $ loader = $ this -> twig -> getLoader ( ) ; if ( method_exists ( $ loader , 'exists' ) ) { return $ loader -> exists ( $ template ) ; } try { // cast possible TemplateReferenceInterface to string because the // EngineInterface supports them but Twig_LoaderInterface does not $ loader -> getSource ( $ template ) -> getCode ( ) ; } catch ( \ Twig_Error_Loader $ e ) { return false ; } return true ; }
checks if a template with given name exists.

@param string $template

@return bool
checks if a template with given name exists .