Skip to content

Commit

Permalink
Allow to read files from addon themes
Browse files Browse the repository at this point in the history
ThemePath function now read files from addon themes if file not exist in main theme.
  • Loading branch information
Balferian committed Nov 19, 2023
1 parent e6ca3bd commit 8cf9960
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/Flux/Template.php
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,15 @@ public function themePath($path, $included = false)
if (file_exists($chk)) {
$uri = $path;
}
} elseif (!file_exists($chk)) {
foreach (Flux::$addons as $_tmpAddon_key => $_tmpAddon) {
$chk = FLUX_ROOT .'/'. FLUX_ADDON_DIR .'/'. $_tmpAddon_key .'/'. preg_replace('/^('.$base.')/', '', $uri );
if (file_exists($chk)) {
$path = sprintf('%s/%s/%s', FLUX_ADDON_DIR, $_tmpAddon_key, preg_replace('/^('.$base.')/', '', $uri ));
$uri = $path;
break;
}
}
}

return $uri . $frag;
Expand Down

0 comments on commit 8cf9960

Please sign in to comment.