diff --git a/system/src/Grav/Common/Themes.php b/system/src/Grav/Common/Themes.php index e1db8d7db..b98817993 100644 --- a/system/src/Grav/Common/Themes.php +++ b/system/src/Grav/Common/Themes.php @@ -311,17 +311,14 @@ protected function loadLanguages(Config $config) */ protected function autoloadTheme($class) { - /** @var UniformResourceLocator $locator */ - $locator = $this->grav['locator']; - $prefix = "Grav\\Theme"; if (false !== strpos($class, $prefix)) { // Remove prefix from class $class = substr($class, strlen($prefix)); // Replace namespace tokens to directory separators - $path = strtolower(ltrim(preg_replace('#\\\|_(?!.+\\\)#', '/', $class), '/')); - $file = $locator->findResource("themes://{$path}/{$path}.php"); + $path = $this->grav['inflector']->hyphenize(ltrim($class,"\\")); + $file = $this->grav['locator']->findResource("themes://{$path}/{$path}.php"); // Load class if (file_exists($file)) {