Twig/DataGridExtension.php
protected function getTemplates(Twig_Environment $environment)
    {
        if (empty($this->templates)) {
            if ($this->theme instanceof Twig_Template) {
                $this->templates[] = $this->theme;
                $this->templates[] = $environment->loadTemplate($this->defaultTemplate);
            } elseif (is_string($this->theme)) {
                $this->templates = $this->getTemplatesFromString($environment, $this->theme);
            } elseif ($this->theme === null) {
                $this->templates = $this->getTemplatesFromString($environment, $this->defaultTemplate);
            } else {
                throw new \Exception('Unable to load template');
            }
        }

        return $this->templates;
    }
protected function getTemplates(Twig_Environment $environment)
    {
        if (empty($this->templates)) {
            if ($this->theme instanceof Twig_Template) {
                $this->templates[] = $this->theme;
                $this->templates[] = $environment->loadTemplate($this->defaultTemplate);
            } elseif (is_string($this->theme)) {
                $this->templates = $this->getTemplatesFromString($environment, $this->theme);
            } elseif ($this->theme === null) {
                $this->templates = $this->getTemplatesFromString($environment, $this->defaultTemplate);
            } else {
                throw new \Exception('Unable to load template');
            }
        }

        return $this->templates;
    }
Template Loader.

@param Twig_Environment $environment

@throws \Exception

@return Twig_Template[]