10000 fix: jump to next section · SRWieZ/fork-nativephp.com@519a5c3 · GitHub
[go: up one dir, main page]

Skip to content

Commit 519a5c3

Browse files
committed
fix: jump to next section
1 parent 1ea2791 commit 519a5c3

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

app/Http/Controllers/ShowDocumentationController.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,15 +93,25 @@ protected function getPageProperties($version, $page = null): array
9393
$pageProperties['nextPage'] = null;
9494
$pageProperties['previousPage'] = null;
9595

96-
foreach ($navigation as $section) {
96+
foreach ($navigation as $i => $section) {
9797
foreach ($section['children'] as $key => $child) {
9898
if ($child['path'] === '/'.$pageProperties['pagePath']) {
9999
if (isset($section['children'][$key + 1])) {
100100
$pageProperties['nextPage'] = $section['children'][$key + 1];
101101
}
102+
elseif(isset($navigation[$i + 1])) {
103+
$navigation[$i + 1]['children'][0]['title'] = $navigation[$i + 1]['title'].': '.$navigation[$i + 1]['children'][0]['title'];
104+
$pageProperties['nextPage'] = $navigation[$i + 1]['children'][0];
105+
}
106+
102107
if (isset($section['children'][$key - 1])) {
103108
$pageProperties['previousPage'] = $section['children'][$key - 1];
104109
}
110+
elseif(isset($navigation[$i - 1])) {
111+
$lastChild = count($navigation[$i - 1]['children'])-1;
112+
$navigation[$i - 1]['children'][$lastChild]['title'] = $navigation[$i - 1]['title'].': '.$navigation[$i - 1]['children'][$lastChild]['title'];
113+
$pageProperties['previousPage'] = $navigation[$i - 1]['children'][$lastChild];
114+
}
105115
}
106116
}
107117
}

0 commit comments

Comments
 (0)
0