Add onSinglePageLoading event; allow skipping pages in onSinglePageLoaded
This commit is contained in:
parent
245cd15770
commit
5bb1c325ff
1 changed files with 7 additions and 2 deletions
|
@ -1017,6 +1017,9 @@ class Pico
|
||||||
|
|
||||||
$id = substr($file, $contentDirLength, -$contentExtLength);
|
$id = substr($file, $contentDirLength, -$contentExtLength);
|
||||||
|
|
||||||
|
// trigger onSinglePageLoading event
|
||||||
|
$this->triggerEvent('onSinglePageLoading', array(&$id));
|
||||||
|
|
||||||
// drop inaccessible pages (e.g. drop "sub.md" if "sub/index.md" exists)
|
// drop inaccessible pages (e.g. drop "sub.md" if "sub/index.md" exists)
|
||||||
$conflictFile = $contentDir . $id . '/index' . $contentExt;
|
$conflictFile = $contentDir . $id . '/index' . $contentExt;
|
||||||
if (in_array($conflictFile, $files, true)) {
|
if (in_array($conflictFile, $files, true)) {
|
||||||
|
@ -1061,10 +1064,12 @@ class Pico
|
||||||
|
|
||||||
unset($rawContent, $meta);
|
unset($rawContent, $meta);
|
||||||
|
|
||||||
// trigger event
|
// trigger onSinglePageLoaded event
|
||||||
$this->triggerEvent('onSinglePageLoaded', array(&$page));
|
$this->triggerEvent('onSinglePageLoaded', array(&$page));
|
||||||
|
|
||||||
$this->pages[$id] = $page;
|
if ($page !== null) {
|
||||||
|
$this->pages[$id] = $page;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue