Move sorting of $pages from Pico::getPages() to Pico::sortPages()

This commit is contained in:
Daniel Rudolf 2015-10-04 22:39:38 +02:00
parent 4f1e8667c3
commit 9d518fd722

View File

@ -298,6 +298,7 @@ class Pico
$this->triggerEvent('onPagesLoading'); $this->triggerEvent('onPagesLoading');
$this->readPages(); $this->readPages();
$this->sortPages();
$this->discoverCurrentPage(); $this->discoverCurrentPage();
$this->triggerEvent('onPagesLoaded', array( $this->triggerEvent('onPagesLoaded', array(
@ -798,7 +799,15 @@ class Pico
$this->pages[$id] = $page; $this->pages[$id] = $page;
} }
}
/**
* Sorts all pages known to Pico
*
* @return void
*/
protected function sortPages()
{
// sort pages // sort pages
$order = $this->getConfig('pages_order'); $order = $this->getConfig('pages_order');
$alphaSortClosure = function ($a, $b) use ($order) { $alphaSortClosure = function ($a, $b) use ($order) {