Skip to content

Commit

Permalink
added support for PSR-4 themes
Browse files Browse the repository at this point in the history
  • Loading branch information
oohnoitz committed Jan 22, 2015
1 parent 0f3448a commit 4e00c96
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions src/Theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,14 @@ public function getExtended()
*/
public function getNamespace()
{
$namespaces_array = $this->getConfig('autoload.psr-0', false);
if ($namespace = $this->getConfig('autoload.psr-4', false)) {
return key($namespace);
}

if ($namespaces_array === false || empty($namespaces_array)) {
return false;
if ($namespace = $this->getConfig('autoload.psr-0', false)) {
return key($namespace).'\\';
}

return key($namespaces_array);
return false;
}
}
2 changes: 1 addition & 1 deletion src/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public static function forge(\Foolz\Theme\Builder $builder, $type, $view)
// get the View object in case it can be found
$theme = $builder->getTheme();
do {
$class = $theme->getNamespace().'\\'.ucfirst($type).'\\'.Util::lowercaseToClassName($view);
$class = $theme->getNamespace().ucfirst($type).'\\'.Util::lowercaseToClassName($view);

if (class_exists($class)) {
$new = new $class();
Expand Down

0 comments on commit 4e00c96

Please sign in to comment.