code/libraries/joomlatools/library/template/engine/twig.php
protected function _import($url, array $data = array())
    {
        if (!parse_url($url, PHP_URL_SCHEME))
        {
            if (!$base = end($this->_stack)) {
                throw new \RuntimeException('Cannot qualify partial template url');
            }

            $url = $this->getObject('template.locator.factory')
                ->createLocator($base)
                ->qualify($url, $base);

            if(array_search($url, $this->_stack))
            {
                throw new \RuntimeException(sprintf(
                    'Template recursion detected while importing "%s" in "%s"', $url, $base
                ));
            }
        }

        $type = pathinfo( $this->_locate($url), PATHINFO_EXTENSION);
        $data = array_merge((array) $this->getData(), $data);

        //If the partial requires a different engine create it and delegate
        if(!in_array($type, $this->getFileTypes()))
        {
            $result = $this->getTemplate()
                ->loadFile($url)
                ->render($data);
        }
        else $result = $this->loadFile($url)->render($data);

        return $result;
    }
protected function _import($url, array $data = array())
    {
        if (!parse_url($url, PHP_URL_SCHEME))
        {
            if (!$base = end($this->_stack)) {
                throw new \RuntimeException('Cannot qualify partial template url');
            }

            $url = $this->getObject('template.locator.factory')
                ->createLocator($base)
                ->qualify($url, $base);

            if(array_search($url, $this->_stack))
            {
                throw new \RuntimeException(sprintf(
                    'Template recursion detected while importing "%s" in "%s"', $url, $base
                ));
            }
        }

        $type = pathinfo( $this->_locate($url), PATHINFO_EXTENSION);
        $data = array_merge((array) $this->getData(), $data);

        //If the partial requires a different engine create it and delegate
        if(!in_array($type, $this->getFileTypes()))
        {
            $result = $this->getTemplate()
                ->loadFile($url)
                ->render($data);
        }
        else $result = $this->loadFile($url)->render($data);

        return $result;
    }
protected function _import ( $ url , array $ data = array ( ) ) { if ( ! parse_url ( $ url , PHP_URL_SCHEME ) ) { if ( ! $ base = end ( $ this -> _stack ) ) { throw new \ RuntimeException ( 'Cannot qualify partial template url' ) ; } $ url = $ this -> getObject ( 'template.locator.factory' ) -> createLocator ( $ base ) -> qualify ( $ url , $ base ) ; if ( array_search ( $ url , $ this -> _stack ) ) { throw new \ RuntimeException ( sprintf ( 'Template recursion detected while importing "%s" in "%s"' , $ url , $ base ) ) ; } } $ type = pathinfo ( $ this -> _locate ( $ url ) , PATHINFO_EXTENSION ) ; $ data = array_merge ( ( array ) $ this -> getData ( ) , $ data ) ; //If the partial requires a different engine create it and delegate if ( ! in_array ( $ type , $ this -> getFileTypes ( ) ) ) { $ result = $ this -> getTemplate ( ) -> loadFile ( $ url ) -> render ( $ data ) ; } else $ result = $ this -> loadFile ( $ url ) -> render ( $ data ) ; return $ result ; }
Import a partial template

If importing a partial merges the data passed in with the data from the call to render. If importing a different
template type jump out of engine scope back to the template.

@param   string  $url      The template url
@param   array   $data     The data to pass to the template
@return  string The rendered template content
Import a partial template