We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6b315c8 commit 09609b1Copy full SHA for 09609b1
src/Menu.php
@@ -2,6 +2,7 @@
2
3
namespace Atthakasem\LaravelJsonMenu;
4
5
+use DOMNodeList;
6
use Illuminate\Support\Collection;
7
8
class Menu
@@ -19,6 +20,22 @@ public function __construct($structure)
19
20
}
21
22
23
+ public function generateBreadcrumb(DOMNodeList $activeLinks): string
24
+ {
25
+ $html = '<ul>';
26
+ foreach ($activeLinks as $key => $link) {
27
+ $active = $key === count($activeLinks) - 1 ? 'active' : '';
28
+ $html .= '<li>
29
+ <a href="' . $link->getAttribute('href') . '" class="' . $active . '">' .
30
+ $link->nodeValue .
31
+ '</a>
32
+ </li>';
33
+ }
34
+ $html .= '</ul>';
35
+
36
+ return $this->stripWhitespaces($html);
37
38
39
public function generateHtml(): string
40
{
41
$html = '<ul>';
0 commit comments