Craft\InstantAnalyticsTwigExtension::_get_current_template_path PHP Method

_get_current_template_path() private method

Get the current template path
private _get_current_template_path ( ) : string
return string the template path
    private function _get_current_template_path()
    {
        $result = "";
        $currentTemplate = craft()->templates->getRenderingTemplate();
        $templatesPath = method_exists(craft()->templates, 'getTemplatesPath') ? craft()->templates->getTemplatesPath() : craft()->path->getTemplatesPath();
        $path_parts = pathinfo($currentTemplate);
        if ($path_parts && isset($path_parts['dirname']) && isset($path_parts['filename'])) {
            $result = $path_parts['dirname'] . "/" . $path_parts['filename'];
            if (substr($result, 0, strlen($templatesPath)) == $templatesPath) {
                $result = substr($result, strlen($templatesPath));
            }
        }
        return $result;
    }