Additional variables removed.
This commit is contained in:
parent
711897e619
commit
c94e384ba3
1 changed files with 5 additions and 9 deletions
14
lib/Pico.php
14
lib/Pico.php
|
@ -1877,22 +1877,18 @@ class Pico
|
|||
if ($orderBy === 'meta') {
|
||||
// sort by arbitrary meta value
|
||||
$orderByMeta = $this->getConfig('pages_order_by_meta');
|
||||
// Split the configuration value into an array of keys to allow sorting by nested meta values.
|
||||
$orderByMetaKeys = explode('.', $orderByMeta);
|
||||
|
||||
uasort($this->pages, function ($a, $b) use ($alphaSortClosure, $order, $orderByMetaKeys) {
|
||||
$aMeta = $a['meta'];
|
||||
$bMeta = $b['meta'];
|
||||
// Iterate through the meta keys to drill down into nested arrays for the final sort value.
|
||||
$aSortValue = $a['meta'];
|
||||
$bSortValue = $b['meta'];
|
||||
|
||||
foreach ($orderByMetaKeys as $key) {
|
||||
$aMeta = isset($aMeta[$key]) ? $aMeta[$key] : null;
|
||||
$bMeta = isset($bMeta[$key]) ? $bMeta[$key] : null;
|
||||
$aSortValue = isset($aSortValue[$key]) ? $aSortValue[$key] : null;
|
||||
$bSortValue = isset($bSortValue[$key]) ? $bSortValue[$key] : null;
|
||||
}
|
||||
|
||||
$aSortValue = $aMeta;
|
||||
$aSortValueNull = ($aSortValue === null);
|
||||
|
||||
$bSortValue = $bMeta;
|
||||
$bSortValueNull = ($bSortValue === null);
|
||||
|
||||
$cmp = 0;
|
||||
|
|
Loading…
Add table
Reference in a new issue