Skip to content

Commit 53231d4

Browse files
committed
[BUGFIX] Display Navigation title in submenu
1 parent caa17bf commit 53231d4

File tree

13 files changed

+400
-4
lines changed

13 files changed

+400
-4
lines changed

packages/guides/src/Compiler/NodeTransformers/MenuNodeTransformers/SubInternalMenuEntryNodeTransformer.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ protected function handleMenuEntry(MenuNode $currentMenu, MenuEntryNode $entryNo
5353
return [];
5454
}
5555

56-
$documentEntryOfMenuEntry = $compilerContext->getProjectNode()->getDocumentEntry($entryNode->getUrl());
5756
$this->addSubEntries($currentMenu, $compilerContext, $entryNode, $documentEntryOfMenuEntry, $entryNode->getLevel() + 1, $maxDepth);
5857

5958
return [$entryNode];
@@ -79,9 +78,15 @@ private function addSubEntries(
7978

8079
foreach ($documentEntry->getMenuEntries() as $subEntryNode) {
8180
if ($subEntryNode instanceof DocumentEntryNode) {
81+
$titleNode = $subEntryNode->getTitle();
82+
$navigationTitle = $subEntryNode->getAdditionalData('navigationTitle');
83+
if ($navigationTitle instanceof TitleNode) {
84+
$titleNode = $navigationTitle;
85+
}
86+
8287
$subMenuEntry = new InternalMenuEntryNode(
8388
$subEntryNode->getFile(),
84-
$subEntryNode->getTitle(),
89+
$titleNode,
8590
[],
8691
false,
8792
$currentLevel,

packages/guides/src/Compiler/Passes/GlobalMenuPass.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,15 @@ private function addSubEntries(
158158

159159
private function createInternalMenuEntry(DocumentEntryNode $subEntryNode, int $currentLevel): InternalMenuEntryNode
160160
{
161+
$titleNode = $subEntryNode->getTitle();
162+
$navigationTitle = $subEntryNode->getAdditionalData('navigationTitle');
163+
if ($navigationTitle instanceof TitleNode) {
164+
$titleNode = $navigationTitle;
165+
}
166+
161167
return new InternalMenuEntryNode(
162168
$subEntryNode->getFile(),
163-
$subEntryNode->getTitle(),
169+
$titleNode,
164170
[],
165171
false,
166172
$currentLevel,

psalm-baseline.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<files psalm-version="5.23.1@8471a896ccea3526b26d082f4461eeea467f10a4">
2+
<files psalm-version="5.24.0@462c80e31c34e58cc4f750c656be3927e80e550e">
33
<file src="packages/guides-cli/src/Config/Configuration.php">
44
<UndefinedMethod>
55
<code><![CDATA[ignoreExtraKeys]]></code>
Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
<!DOCTYPE html>
2+
<html class="no-js" lang="en">
3+
<head>
4+
<title>Document Title - Bootstrap Theme</title>
5+
<!-- Required meta tags -->
6+
<meta charset="utf-8">
7+
<meta name="viewport" content="width=device-width, initial-scale=1">
8+
9+
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
10+
</head>
11+
<body>
12+
<header class="">
13+
14+
<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
15+
<div class="container">
16+
17+
<a class="navbar-brand" href="#">Navbar</a>
18+
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
19+
<span class="navbar-toggler-icon"></span>
20+
</button>
21+
<div class="collapse navbar-collapse" id="navbarSupportedContent">
22+
23+
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
24+
<li class="nav-item">
25+
<a href="someDir/index.html" class="nav-link">
26+
Some Directory
27+
</a>
28+
</li>
29+
<ul class="level-">
30+
<li class="nav-item">
31+
<a href="someDir/index.html"
32+
class="nav-link">Some Directory</a>
33+
</li>
34+
</ul>
35+
</ul>
36+
37+
</div>
38+
</div>
39+
</nav>
40+
</header>
41+
<main id="main-content">
42+
<div class="container">
43+
<div class="container">
44+
<div class="row">
45+
<div class="col-lg-3">
46+
<nav class="nav flex-column">
47+
<ul class="menu-level-main">
48+
<li>
49+
<a href="someDir/index.html"
50+
class="nav-link">Some Directory</a>
51+
<ul class="level-1">
52+
<li>
53+
<a href="someDir/anotherPage.html"
54+
class="nav-link">Another Page</a>
55+
</li>
56+
<li>
57+
<a href="someDir/somePage.html"
58+
class="nav-link">Some Page</a>
59+
</li>
60+
<li>
61+
<a href="someDir/yetAnotherPage.html"
62+
class="nav-link">Title in Menu</a>
63+
</li>
64+
</ul>
65+
66+
</li>
67+
</ul>
68+
</nav>
69+
70+
</div>
71+
<div class="col-lg-9">
72+
73+
<nav aria-label="breadcrumb">
74+
<ol class="breadcrumb">
75+
<li class="breadcrumb-item"><a href="#">Document Title</a></li>
76+
</ol>
77+
</nav>
78+
<!-- content start -->
79+
80+
<div class="section" id="document-title">
81+
<h1>Document Title</h1>
82+
83+
<p>Lorem Ipsum Dolor.</p>
84+
85+
<div class="toc">
86+
<ul class="menu-level">
87+
<li class="toc-item">
88+
<a href="someDir/index.html#some-directory">Some Directory</a>
89+
<ul class="menu-level-1">
90+
<li class="toc-item">
91+
<a href="someDir/anotherPage.html#another-page">Another Page</a>
92+
93+
94+
</li>
95+
<li class="toc-item">
96+
<a href="someDir/somePage.html#some-page">Some Page</a>
97+
98+
99+
</li>
100+
<li class="toc-item">
101+
<a href="someDir/yetAnotherPage.html">Title in Menu</a>
102+
103+
104+
</li>
105+
</ul>
106+
107+
</li>
108+
</ul>
109+
</div>
110+
</div>
111+
<!-- content end -->
112+
</div>
113+
</div>
114+
</div>
115+
</div>
116+
</main>
117+
<footer class="bg-primary text-light">
118+
<div class="container">
119+
120+
<p>Generated by <a href="https://www.phpdoc.org/">phpDocumentor</a>.</p>
121+
122+
</div>
123+
</footer>
124+
125+
<!-- Optional JavaScript; choose one of the two! -->
126+
127+
<!-- Option 1: Bootstrap Bundle with Popper -->
128+
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
129+
130+
<!-- Option 2: Separate Popper and Bootstrap JS -->
131+
<!--
132+
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.2/dist/umd/popper.min.js" integrity="sha384-IQsoLXl5PILFhosVNubq5LC7Qb9DXgDA9i+tQ8Zj3iwWAwPtgFTxbJ8NT4GN1R8p" crossorigin="anonymous"></script>
133+
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.min.js" integrity="sha384-cVKIPhGWiC2Al4u+LWgxfKTRIcfu0JTxR+EQDz/bgldoEyl4H0zUF0QKbrJ0EcQF" crossorigin="anonymous"></script>
134+
-->
135+
</body>
136+
</html>
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
{
2+
"std:doc": {
3+
"index": [
4+
"Bootstrap Theme",
5+
"1.0",
6+
"index.html",
7+
"Document Title"
8+
],
9+
"someDir\/anotherPage": [
10+
"Bootstrap Theme",
11+
"1.0",
12+
"someDir\/anotherPage.html",
13+
"Another Page"
14+
],
15+
"someDir\/index": [
16+
"Bootstrap Theme",
17+
"1.0",
18+
"someDir\/index.html",
19+
"Some Directory"
20+
],
21+
"someDir\/somePage": [
22+
"Bootstrap Theme",
23+
"1.0",
24+
"someDir\/somePage.html",
25+
"Some Page"
26+
],
27+
"someDir\/yetAnotherPage": [
28+
"Bootstrap Theme",
29+
"1.0",
30+
"someDir\/yetAnotherPage.html",
31+
"Yet Another Page"
32+
]
33+
},
34+
"std:label": [],
35+
"std:title": {
36+
"document-title": [
37+
"Bootstrap Theme",
38+
"1.0",
39+
"index.html#document-title",
40+
"Document Title"
41+
],
42+
"another-page": [
43+
"Bootstrap Theme",
44+
"1.0",
45+
"someDir\/anotherPage.html#another-page",
46+
"Another Page"
47+
],
48+
"some-directory": [
49+
"Bootstrap Theme",
50+
"1.0",
51+
"someDir\/index.html#some-directory",
52+
"Some Directory"
53+
],
54+
"some-page": [
55+
"Bootstrap Theme",
56+
"1.0",
57+
"someDir\/somePage.html#some-page",
58+
"Some Page"
59+
],
60+
"yet-another-page": [
61+
"Bootstrap Theme",
62+
"1.0",
63+
"someDir\/yetAnotherPage.html#yet-another-page",
64+
"Yet Another Page"
65+
]
66+
}
67+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
<!DOCTYPE html>
2+
<html class="no-js" lang="en">
3+
<head>
4+
<title>Yet Another Page - Bootstrap Theme</title>
5+
<!-- Required meta tags -->
6+
<meta charset="utf-8">
7+
<meta name="viewport" content="width=device-width, initial-scale=1">
8+
Title in Menu
9+
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
10+
</head>
11+
<body>
12+
<header class="">
13+
14+
<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
15+
<div class="container">
16+
17+
<a class="navbar-brand" href="#">Navbar</a>
18+
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
19+
<span class="navbar-toggler-icon"></span>
20+
</button>
21+
<div class="collapse navbar-collapse" id="navbarSupportedContent">
22+
23+
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
24+
<li class="nav-item">
25+
<a href="index.html" class="nav-link active">
26+
Some Directory
27+
</a>
28+
</li>
29+
<ul class="level-">
30+
<li class="nav-item">
31+
<a href="index.html"
32+
class="nav-link active">Some Directory</a>
33+
</li>
34+
</ul>
35+
</ul>
36+
37+
</div>
38+
</div>
39+
</nav>
40+
</header>
41+
<main id="main-content">
42+
<div class="container">
43+
<div class="container">
44+
<div class="row">
45+
<div class="col-lg-3">
46+
<nav class="nav flex-column">
47+
<ul class="menu-level-main">
48+
<li>
49+
<a href="index.html"
50+
class="nav-link active">Some Directory</a>
51+
<ul class="level-1">
52+
<li>
53+
<a href="anotherPage.html"
54+
class="nav-link">Another Page</a>
55+
</li>
56+
<li>
57+
<a href="somePage.html"
58+
class="nav-link">Some Page</a>
59+
</li>
60+
<li>
61+
<a href="#"
62+
class="nav-link current active" aria-current="page">Title in Menu</a>
63+
</li>
64+
</ul>
65+
66+
</li>
67+
</ul>
68+
</nav>
69+
70+
</div>
71+
<div class="col-lg-9">
72+
73+
<nav aria-label="breadcrumb">
74+
<ol class="breadcrumb">
75+
<li class="breadcrumb-item"><a href="../index.html">Document Title</a></li>
76+
<li class="breadcrumb-item"><a href="index.html">Some Directory</a></li>
77+
<li class="breadcrumb-item"><a href="#">Title in Menu</a></li>
78+
</ol>
79+
</nav>
80+
<!-- content start -->
81+
82+
<div class="section" id="yet-another-page">
83+
<h1>Yet Another Page</h1>
84+
85+
<p>Lorem Ipsum Dolor.</p>
86+
87+
</div>
88+
<!-- content end -->
89+
</div>
90+
</div>
91+
</div>
92+
</div>
93+
</main>
94+
<footer class="bg-primary text-light">
95+
<div class="container">
96+
97+
<p>Generated by <a href="https://www.phpdoc.org/">phpDocumentor</a>.</p>
98+
99+
</div>
100+
</footer>
101+
102+
<!-- Optional JavaScript; choose one of the two! -->
103+
104+
<!-- Option 1: Bootstrap Bundle with Popper -->
105+
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
106+
107+
<!-- Option 2: Separate Popper and Bootstrap JS -->
108+
<!--
109+
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.2/dist/umd/popper.min.js" integrity="sha384-IQsoLXl5PILFhosVNubq5LC7Qb9DXgDA9i+tQ8Zj3iwWAwPtgFTxbJ8NT4GN1R8p" crossorigin="anonymous"></script>
110+
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.min.js" integrity="sha384-cVKIPhGWiC2Al4u+LWgxfKTRIcfu0JTxR+EQDz/bgldoEyl4H0zUF0QKbrJ0EcQF" crossorigin="anonymous"></script>
111+
-->
112+
</body>
113+
</html>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<guides xmlns="https://www.phpdoc.org/guides"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="https://www.phpdoc.org/guides packages/guides-cli/resources/schema/guides.xsd"
5+
theme="bootstrap"
6+
links-are-relative="true"
7+
>
8+
<extension class="phpDocumentor\Guides\Bootstrap"/>
9+
</guides>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.. documentblock::
2+
:identifier: footer
3+
4+
Generated by `phpDocumentor <https://www.phpdoc.org/>`__.
5+
6+
.. role:: custom

0 commit comments

Comments
 (0)