Skip to content

Commit deb6945

Browse files
committed
feat: allow overriding namespaced views via app/Views
1 parent 08bc0f8 commit deb6945

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

system/View/View.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,16 @@ public function render(string $view, ?array $options = null, ?bool $saveData = n
201201

202202
$this->renderVars['file'] = $this->viewPath . $this->renderVars['view'];
203203

204+
// Check for overridden namespaced view in app/Views
205+
if (! is_file($this->renderVars['file'])) {
206+
// Normalize directory separators
207+
$path = str_replace('\\', DIRECTORY_SEPARATOR, $this->renderVars['view']);
208+
209+
if (is_file($this->viewPath . $path)) {
210+
$this->renderVars['file'] = $this->viewPath . $path;
211+
}
212+
}
213+
204214
if (! is_file($this->renderVars['file'])) {
205215
$this->renderVars['file'] = $this->loader->locateFile(
206216
$this->renderVars['view'],

0 commit comments

Comments
 (0)