mirror of
https://github.com/processwire/processwire.git
synced 2025-08-28 08:59:52 +02:00
Small adjustment to liveSearch and missing 'n' property notice in last commit per @matjazpotocnik
This commit is contained in:
@@ -577,7 +577,7 @@ class ProcessPageSearchLive extends Wire {
|
|||||||
$order = array_search($thisType, $this->searchTypesOrder);
|
$order = array_search($thisType, $this->searchTypesOrder);
|
||||||
$order = $order * 100;
|
$order = $order * 100;
|
||||||
|
|
||||||
$title = empty($result['title']) ? $info['title'] : $result['title'];
|
$title = empty($result['title']) ? "$info[title]" : "$result[title]";
|
||||||
$n = $liveSearch['start'];
|
$n = $liveSearch['start'];
|
||||||
$item = null;
|
$item = null;
|
||||||
|
|
||||||
@@ -591,6 +591,7 @@ class ProcessPageSearchLive extends Wire {
|
|||||||
foreach($result['items'] as $item) {
|
foreach($result['items'] as $item) {
|
||||||
$n++;
|
$n++;
|
||||||
$item = array_merge($this->itemTemplate, $item);
|
$item = array_merge($this->itemTemplate, $item);
|
||||||
|
$item['group'] = empty($item['group']) ? "$title" : "$item[group]";
|
||||||
if(empty($item['group'])) $item['group'] = $title;
|
if(empty($item['group'])) $item['group'] = $title;
|
||||||
$item['n'] = "$n/$result[total]";
|
$item['n'] = "$n/$result[total]";
|
||||||
$items[$order] = $item;
|
$items[$order] = $item;
|
||||||
@@ -1119,10 +1120,12 @@ class ProcessPageSearchLive extends Wire {
|
|||||||
foreach($items as $item) {
|
foreach($items as $item) {
|
||||||
if($item['group'] != $group) {
|
if($item['group'] != $group) {
|
||||||
$group = $item['group'];
|
$group = $item['group'];
|
||||||
list(,$total) = explode('/', $item['n']);
|
|
||||||
$totals[$group] = (int) $total;
|
|
||||||
$groups[$group] = '';
|
$groups[$group] = '';
|
||||||
}
|
}
|
||||||
|
if(empty($totals[$group]) && isset($item['n'])) {
|
||||||
|
list(, $total) = explode('/', $item['n']);
|
||||||
|
$totals[$group] = (int) $total;
|
||||||
|
}
|
||||||
if($item['name'] === 'view-all') {
|
if($item['name'] === 'view-all') {
|
||||||
if($pagination) continue;
|
if($pagination) continue;
|
||||||
$groupLabel = $this->wire('sanitizer')->entities($group);
|
$groupLabel = $this->wire('sanitizer')->entities($group);
|
||||||
|
Reference in New Issue
Block a user