public function getTemplateForField(IFormField $field)
    {
        $reflect  = new \ReflectionClass($field);
        $fullName = $reflect->getFileName();

        while ($reflect !== null) {

            $templateName = lcfirst($reflect->getShortName()) . '.phtml';

            // look up the cache
            if (isset($this->cache[$fullName])) {
                return $this->cache[$fullName];
            }

            // try to find the template in the include paths
            foreach ($this->includePaths as $includePath) {

                $path = $includePath . '/' . $templateName;

                if (file_exists($path)) {
                    // cache locally
                    $this->cache[$fullName] = $path;

                    // get the path
                    return $path;
                }
            }

            // move up to the parent class
            $reflect = $reflect->getParentClass();
        }

        throw new \RuntimeException(
            'Could not find template for "' . $fullName . '" in any of the paths "' .
            implode(', ', $this->includePaths) . '"'
        );
    }
public function getTemplateForField(IFormField $field)
    {
        $reflect  = new \ReflectionClass($field);
        $fullName = $reflect->getFileName();

        while ($reflect !== null) {

            $templateName = lcfirst($reflect->getShortName()) . '.phtml';

            // look up the cache
            if (isset($this->cache[$fullName])) {
                return $this->cache[$fullName];
            }

            // try to find the template in the include paths
            foreach ($this->includePaths as $includePath) {

                $path = $includePath . '/' . $templateName;

                if (file_exists($path)) {
                    // cache locally
                    $this->cache[$fullName] = $path;

                    // get the path
                    return $path;
                }
            }

            // move up to the parent class
            $reflect = $reflect->getParentClass();
        }

        throw new \RuntimeException(
            'Could not find template for "' . $fullName . '" in any of the paths "' .
            implode(', ', $this->includePaths) . '"'
        );
    }
@param IFormField $field

TODO: how about some first level caching here?

@return string