protected function autoloadTheme($class)
    {
        $prefix = 'Grav\\Theme\\';
        if (false !== strpos($class, $prefix)) {
            // Remove prefix from class
            $class = substr($class, strlen($prefix));
            $locator = $this->grav['locator'];

            // First try lowercase version of the classname.
            $path = strtolower($class);
            $file = $locator("themes://{$path}/theme.php") ?: $locator("themes://{$path}/{$path}.php");

            if ($file) {
                return include_once $file;
            }

            // Replace namespace tokens to directory separators
            $path = $this->grav['inflector']->hyphenize($class);
            $file = $locator("themes://{$path}/theme.php") ?: $locator("themes://{$path}/{$path}.php");

            // Load class
            if ($file) {
                return include_once $file;
            }

            // Try Old style theme classes
            $path = strtolower(preg_replace('#\\\|_(?!.+\\\)#', '/', $class));
            $file = $locator("themes://{$path}/theme.php") ?: $locator("themes://{$path}/{$path}.php");

            // Load class
            if ($file) {
                return include_once $file;
            }
        }

        return false;
    }