Skip to content

Commit ede6d00

Browse files
committed
Changed the menu label for the files, added setMenuLabel().
1 parent 708b5b7 commit ede6d00

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

src/DocsViewer.php

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ class DocsViewer
99
const ERROR_NO_DOCUMENTS_AVAILABLE = 82001;
1010

1111
private string $title = 'Documentation';
12+
private string $menuLabel = 'Available documents';
1213

1314
private DocsManager $docs;
1415

@@ -35,12 +36,30 @@ public function __construct(DocsManager $manager, string $vendorURL)
3536
}
3637
}
3738

39+
/**
40+
* Sets the title of the document and the navigation label.
41+
*
42+
* @param string $title
43+
* @return $this
44+
*/
3845
public function setTitle(string $title) : DocsViewer
3946
{
4047
$this->title = $title;
4148
return $this;
4249
}
4350

51+
/**
52+
* Sets the label of the menu item listing all the available documents.
53+
*
54+
* @param string $label
55+
* @return $this
56+
*/
57+
public function setMenuLabel(string $label) : DocsViewer
58+
{
59+
$this->menuLabel = $label;
60+
return $this;
61+
}
62+
4463
public function getActiveFileID() : string
4564
{
4665
if(isset($_REQUEST['doc']) && $this->docs->idExists($_REQUEST['doc'])) {
@@ -73,7 +92,7 @@ public function display() : void
7392
<ul class="navbar-nav mr-auto">
7493
<li class="nav-item dropdown">
7594
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
76-
Documentation files
95+
<?php echo $this->menuLabel ?>
7796
</a>
7897
<div class="dropdown-menu" aria-labelledby="navbarDropdown" style="position: absolute">
7998
<?php

0 commit comments

Comments
 (0)