Skip to content

Commit 2ae5e93

Browse files
datamwebmichalsn
andauthored
refactor: optimize namespaced view path resolution
Co-authored-by: Michal Sniatala <[email protected]>
1 parent cb7fc66 commit 2ae5e93

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

system/View/View.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,12 @@ public function render(string $view, ?array $options = null, ?bool $saveData = n
210210
$this->renderVars['file'] = $this->viewPath . $path;
211211
}
212212
}
213+
if (str_contains($this->renderVars['view'], '\\')) {
214+
$this->renderVars['file'] = $this->viewPath . ltrim(str_replace('\\', DIRECTORY_SEPARATOR, $this->renderVars['view']), DIRECTORY_SEPARATOR);
215+
} else {
216+
$this->renderVars['file'] = $this->viewPath . $this->renderVars['view'];
217+
}
218+
213219

214220
if (! is_file($this->renderVars['file'])) {
215221
$this->renderVars['file'] = $this->loader->locateFile(

0 commit comments

Comments
 (0)