Skip to content

Commit 204511b

Browse files
authored
Merge pull request #25 from ovenum/fix/pass-callable-as-path-option
Allow closure as option for template path
2 parents bda308a + acb4eee commit 204511b

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

src/Paths.php

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,17 @@ class Paths
66
{
77
public static function getPathTemplates(): string
88
{
9-
$optionPath = option('leitsch.blade.templates');
9+
$path = option('leitsch.blade.templates');
1010

11-
if ($optionPath !== null && is_dir($optionPath)) {
12-
if (is_callable($optionPath)) {
13-
return $optionPath();
14-
}
11+
if (is_callable($path)) {
12+
return $path();
13+
}
1514

16-
$path = kirby()->roots()->index() . "/" . $optionPath;
17-
} else {
18-
$path = kirby()->root('templates');
15+
if ($path !== null) {
16+
return kirby()->roots()->index() . '/' . $path;
1917
}
2018

21-
return $path;
19+
return kirby()->root('templates');
2220
}
2321

2422
public static function getPathViews(): string

0 commit comments

Comments
 (0)