Skip to content

[BUGFIX] Display Navigation title in submenu #1020

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ protected function handleMenuEntry(MenuNode $currentMenu, MenuEntryNode $entryNo
return [];
}

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

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

foreach ($documentEntry->getMenuEntries() as $subEntryNode) {
if ($subEntryNode instanceof DocumentEntryNode) {
$titleNode = $subEntryNode->getTitle();
$navigationTitle = $subEntryNode->getAdditionalData('navigationTitle');
if ($navigationTitle instanceof TitleNode) {
$titleNode = $navigationTitle;
}

$subMenuEntry = new InternalMenuEntryNode(
$subEntryNode->getFile(),
$subEntryNode->getTitle(),
$titleNode,
[],
false,
$currentLevel,
Expand Down
8 changes: 7 additions & 1 deletion packages/guides/src/Compiler/Passes/GlobalMenuPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,15 @@ private function addSubEntries(

private function createInternalMenuEntry(DocumentEntryNode $subEntryNode, int $currentLevel): InternalMenuEntryNode
{
$titleNode = $subEntryNode->getTitle();
$navigationTitle = $subEntryNode->getAdditionalData('navigationTitle');
if ($navigationTitle instanceof TitleNode) {
$titleNode = $navigationTitle;
}

return new InternalMenuEntryNode(
$subEntryNode->getFile(),
$subEntryNode->getTitle(),
$titleNode,
[],
false,
$currentLevel,
Expand Down
2 changes: 1 addition & 1 deletion psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="5.23.1@8471a896ccea3526b26d082f4461eeea467f10a4">
<files psalm-version="5.24.0@462c80e31c34e58cc4f750c656be3927e80e550e">
<file src="packages/guides-cli/src/Config/Configuration.php">
<UndefinedMethod>
<code><![CDATA[ignoreExtraKeys]]></code>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
<!DOCTYPE html>
<html class="no-js" lang="en">
<head>
<title>Document Title - Bootstrap Theme</title>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">

<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
</head>
<body>
<header class="">

<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
<div class="container">

<a class="navbar-brand" href="#">Navbar</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">

<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item">
<a href="someDir/index.html" class="nav-link">
Some Directory
</a>
</li>
<ul class="level-">
<li class="nav-item">
<a href="someDir/index.html"
class="nav-link">Some Directory</a>
</li>
</ul>
</ul>

</div>
</div>
</nav>
</header>
<main id="main-content">
<div class="container">
<div class="container">
<div class="row">
<div class="col-lg-3">
<nav class="nav flex-column">
<ul class="menu-level-main">
<li>
<a href="someDir/index.html"
class="nav-link">Some Directory</a>
<ul class="level-1">
<li>
<a href="someDir/anotherPage.html"
class="nav-link">Another Page</a>
</li>
<li>
<a href="someDir/somePage.html"
class="nav-link">Some Page</a>
</li>
<li>
<a href="someDir/yetAnotherPage.html"
class="nav-link">Title in Menu</a>
</li>
</ul>

</li>
</ul>
</nav>

</div>
<div class="col-lg-9">

<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="#">Document Title</a></li>
</ol>
</nav>
<!-- content start -->

<div class="section" id="document-title">
<h1>Document Title</h1>

<p>Lorem Ipsum Dolor.</p>

<div class="toc">
<ul class="menu-level">
<li class="toc-item">
<a href="someDir/index.html#some-directory">Some Directory</a>
<ul class="menu-level-1">
<li class="toc-item">
<a href="someDir/anotherPage.html#another-page">Another Page</a>


</li>
<li class="toc-item">
<a href="someDir/somePage.html#some-page">Some Page</a>


</li>
<li class="toc-item">
<a href="someDir/yetAnotherPage.html">Title in Menu</a>


</li>
</ul>

</li>
</ul>
</div>
</div>
<!-- content end -->
</div>
</div>
</div>
</div>
</main>
<footer class="bg-primary text-light">
<div class="container">

<p>Generated by <a href="https://www.phpdoc.org/">phpDocumentor</a>.</p>

</div>
</footer>

<!-- Optional JavaScript; choose one of the two! -->

<!-- Option 1: Bootstrap Bundle with Popper -->
<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>

<!-- Option 2: Separate Popper and Bootstrap JS -->
<!--
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.2/dist/umd/popper.min.js" integrity="sha384-IQsoLXl5PILFhosVNubq5LC7Qb9DXgDA9i+tQ8Zj3iwWAwPtgFTxbJ8NT4GN1R8p" crossorigin="anonymous"></script>
<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>
-->
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"std:doc": {
"index": [
"Bootstrap Theme",
"1.0",
"index.html",
"Document Title"
],
"someDir\/anotherPage": [
"Bootstrap Theme",
"1.0",
"someDir\/anotherPage.html",
"Another Page"
],
"someDir\/index": [
"Bootstrap Theme",
"1.0",
"someDir\/index.html",
"Some Directory"
],
"someDir\/somePage": [
"Bootstrap Theme",
"1.0",
"someDir\/somePage.html",
"Some Page"
],
"someDir\/yetAnotherPage": [
"Bootstrap Theme",
"1.0",
"someDir\/yetAnotherPage.html",
"Yet Another Page"
]
},
"std:label": [],
"std:title": {
"document-title": [
"Bootstrap Theme",
"1.0",
"index.html#document-title",
"Document Title"
],
"another-page": [
"Bootstrap Theme",
"1.0",
"someDir\/anotherPage.html#another-page",
"Another Page"
],
"some-directory": [
"Bootstrap Theme",
"1.0",
"someDir\/index.html#some-directory",
"Some Directory"
],
"some-page": [
"Bootstrap Theme",
"1.0",
"someDir\/somePage.html#some-page",
"Some Page"
],
"yet-another-page": [
"Bootstrap Theme",
"1.0",
"someDir\/yetAnotherPage.html#yet-another-page",
"Yet Another Page"
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
<!DOCTYPE html>
<html class="no-js" lang="en">
<head>
<title>Yet Another Page - Bootstrap Theme</title>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
Title in Menu
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
</head>
<body>
<header class="">

<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
<div class="container">

<a class="navbar-brand" href="#">Navbar</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">

<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item">
<a href="index.html" class="nav-link active">
Some Directory
</a>
</li>
<ul class="level-">
<li class="nav-item">
<a href="index.html"
class="nav-link active">Some Directory</a>
</li>
</ul>
</ul>

</div>
</div>
</nav>
</header>
<main id="main-content">
<div class="container">
<div class="container">
<div class="row">
<div class="col-lg-3">
<nav class="nav flex-column">
<ul class="menu-level-main">
<li>
<a href="index.html"
class="nav-link active">Some Directory</a>
<ul class="level-1">
<li>
<a href="anotherPage.html"
class="nav-link">Another Page</a>
</li>
<li>
<a href="somePage.html"
class="nav-link">Some Page</a>
</li>
<li>
<a href="#"
class="nav-link current active" aria-current="page">Title in Menu</a>
</li>
</ul>

</li>
</ul>
</nav>

</div>
<div class="col-lg-9">

<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="../index.html">Document Title</a></li>
<li class="breadcrumb-item"><a href="index.html">Some Directory</a></li>
<li class="breadcrumb-item"><a href="#">Title in Menu</a></li>
</ol>
</nav>
<!-- content start -->

<div class="section" id="yet-another-page">
<h1>Yet Another Page</h1>

<p>Lorem Ipsum Dolor.</p>

</div>
<!-- content end -->
</div>
</div>
</div>
</div>
</main>
<footer class="bg-primary text-light">
<div class="container">

<p>Generated by <a href="https://www.phpdoc.org/">phpDocumentor</a>.</p>

</div>
</footer>

<!-- Optional JavaScript; choose one of the two! -->

<!-- Option 1: Bootstrap Bundle with Popper -->
<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>

<!-- Option 2: Separate Popper and Bootstrap JS -->
<!--
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.2/dist/umd/popper.min.js" integrity="sha384-IQsoLXl5PILFhosVNubq5LC7Qb9DXgDA9i+tQ8Zj3iwWAwPtgFTxbJ8NT4GN1R8p" crossorigin="anonymous"></script>
<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>
-->
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8" ?>
<guides xmlns="https://www.phpdoc.org/guides"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://www.phpdoc.org/guides packages/guides-cli/resources/schema/guides.xsd"
theme="bootstrap"
links-are-relative="true"
>
<extension class="phpDocumentor\Guides\Bootstrap"/>
</guides>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.. documentblock::
:identifier: footer

Generated by `phpDocumentor <https://www.phpdoc.org/>`__.

.. role:: custom
Loading
Loading