mirror of
https://github.com/ad-aures/castopod.git
synced 2026-04-15 12:37:46 +02:00
refactor(componentrenderer): update locateView using a lookupModules property in config
This commit is contained in:
parent
a95de8bab0
commit
58c8839902
3 changed files with 39 additions and 6 deletions
|
|
@ -137,12 +137,13 @@ class ComponentRenderer
|
|||
private function locateView(string $name): string
|
||||
{
|
||||
// TODO: Is there a better way to locate components local to current module?
|
||||
$modulesToDiscover = [APPPATH];
|
||||
foreach (config('Autoload')->psr4 as $namespace => $path) {
|
||||
if (str_starts_with($this->currentView, $namespace)) {
|
||||
array_unshift($modulesToDiscover, $path);
|
||||
}
|
||||
}
|
||||
$modulesToDiscover = [];
|
||||
$lookupModules = $this->config->lookupModules;
|
||||
$modulesToDiscover = array_filter($lookupModules, function ($namespace): bool {
|
||||
return str_starts_with($this->currentView, $namespace);
|
||||
}, ARRAY_FILTER_USE_KEY);
|
||||
$modulesToDiscover = array_values($modulesToDiscover);
|
||||
$modulesToDiscover[] = $this->config->defaultLookupPath;
|
||||
|
||||
$namePath = str_replace('.', '/', $name);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue