Skip to content

Commit b4b3544

Browse files
Bug Fix
1 parent 95ca03f commit b4b3544

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

engine/kernel/page.php

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,10 @@ public function children($x = 'page', $deep = 0) {
121121
}
122122
return null;
123123
}
124-
return Pages::from(dirname($path = $this->path) . D . pathinfo($path, PATHINFO_FILENAME), $x, $deep);
124+
if (is_dir($folder = dirname($path = $this->path) . D . pathinfo($path, PATHINFO_FILENAME))) {
125+
return Pages::from($folder, $x, $deep);
126+
}
127+
return null;
125128
}
126129

127130
public function content(...$lot) {
@@ -282,19 +285,19 @@ public function parent(array $lot = []) {
282285
return null;
283286
}
284287
if ($path = $this['parent']) {
285-
if (!is_string($path) || !is_file($path)) {
286-
return null;
288+
if (is_string($path) && is_file($path)) {
289+
return new static($path, $lot);
287290
}
288-
return new static($path, $lot);
291+
return null;
289292
}
290293
$folder = dirname($this->path);
291-
if (!$path = exist([
294+
if ($path = exist([
292295
$folder . '.archive',
293296
$folder . '.page'
294297
], 1)) {
295-
return null;
298+
return new static($path, $lot);
296299
}
297-
return new static($path, $lot);
300+
return null;
298301
}
299302

300303
public function route(...$lot) {

0 commit comments

Comments
 (0)