|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* This file is part of the adminbsb-material-design-bundle package. |
|
5
|
|
|
* |
|
6
|
|
|
* (c) 2017 WEBEWEB |
|
7
|
|
|
* |
|
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
9
|
|
|
* file that was distributed with this source code. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace WBW\Bundle\AdminBSBBundle\Provider\Navigation; |
|
13
|
|
|
|
|
14
|
|
|
use Symfony\Component\Routing\RouterInterface; |
|
15
|
|
|
use WBW\Bundle\BootstrapBundle\Navigation\Node\BreadcrumbNode; |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* How-to navigation provider. |
|
19
|
|
|
* |
|
20
|
|
|
* @author webeweb <https://github.com/webeweb/> |
|
21
|
|
|
* @package WBW\Bundle\AdminBSBBundle\Provider\Navigation |
|
22
|
|
|
*/ |
|
23
|
|
|
class HowToNavigationProvider { |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* Router. |
|
27
|
|
|
* |
|
28
|
|
|
* @var RouterInterface |
|
29
|
|
|
*/ |
|
30
|
|
|
private $router; |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* Constructor. |
|
34
|
|
|
* |
|
35
|
|
|
* @param RouterInterface $router The router service. |
|
36
|
|
|
*/ |
|
37
|
|
|
public function __construct(RouterInterface $router) { |
|
38
|
|
|
$this->router = $router; |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* Get the breadcrumb. |
|
43
|
|
|
* |
|
44
|
|
|
* @return BreadcrumbNode Returns the breadcrumb. |
|
45
|
|
|
*/ |
|
46
|
|
|
public function getBreadcrumb() { |
|
47
|
|
|
|
|
48
|
|
|
// Get the table of contents. |
|
49
|
|
|
$tableContents = $this->getTableContents(); |
|
50
|
|
|
|
|
51
|
|
|
// Create the breadcrumb node. |
|
52
|
|
|
$breadcrumbRoot = new BreadcrumbNode("navigation.how-to", "book"); |
|
53
|
|
|
|
|
54
|
|
|
// Initialize the route. |
|
55
|
|
|
$route = "absbmd_howto_index"; |
|
56
|
|
|
|
|
57
|
|
|
// Handle each page. |
|
58
|
|
|
foreach ($tableContents as $current) { |
|
59
|
|
|
$breadcrumb = new BreadcrumbNode($current["title"], "bookmark", $route); |
|
60
|
|
|
$breadcrumb->setUrl($this->router->generate($route, ["page" => $current["page"]])); |
|
61
|
|
|
$breadcrumbRoot->addNode($breadcrumb); |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
// Return the breadcrumb. |
|
65
|
|
|
return $breadcrumbRoot; |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
|
|
/** |
|
69
|
|
|
* Get the table of contents. |
|
70
|
|
|
* |
|
71
|
|
|
* @return array Returns the table of contents. |
|
72
|
|
|
*/ |
|
73
|
|
|
public function getTableContents() { |
|
74
|
|
|
|
|
75
|
|
|
// Initialize the table of contents. |
|
76
|
|
|
$tableContents = []; |
|
77
|
|
|
$tableContents[] = ["title" => "Table of contents", "page" => "index"]; |
|
78
|
|
|
$tableContents[] = ["title" => "Twig extension > Typography > Headings", "page" => "extension:typography:heading"]; |
|
79
|
|
|
$tableContents[] = ["title" => "Twig extension > UI > Alerts", "page" => "extension:ui:alert"]; |
|
80
|
|
|
$tableContents[] = ["title" => "Twig extension > UI > Badges", "page" => "extension:ui:badge"]; |
|
81
|
|
|
$tableContents[] = ["title" => "Twig extension > UI > Buttons", "page" => "extension:ui:button"]; |
|
82
|
|
|
$tableContents[] = ["title" => "Twig extension > UI > Icons", "page" => "extension:ui:icon"]; |
|
83
|
|
|
$tableContents[] = ["title" => "Twig extension > UI > Labels", "page" => "extension:ui:label"]; |
|
84
|
|
|
$tableContents[] = ["title" => "Twig extension > UI > Preloaders", "page" => "extension:ui:preloader"]; |
|
85
|
|
|
$tableContents[] = ["title" => "Twig extension > UI > Progress Bars", "page" => "extension:ui:progress-bar"]; |
|
86
|
|
|
$tableContents[] = ["title" => "Twig extension > Widgets > Cards", "page" => "extension:widget:card"]; |
|
87
|
|
|
$tableContents[] = ["title" => "Twig extension > Form > Checkbox", "page" => "extension:form:checkbox"]; |
|
88
|
|
|
$tableContents[] = ["title" => "Twig extension > Form > Datetime pickers", "page" => "extension:form:datetime-picker"]; |
|
89
|
|
|
$tableContents[] = ["title" => "Twig extension > Form > Radio buttons", "page" => "extension:form:radio-button"]; |
|
90
|
|
|
$tableContents[] = ["title" => "Twig extension > Form > Switch buttons", "page" => "extension:form:switch-button"]; |
|
91
|
|
|
$tableContents[] = ["title" => "Providers", "page" => "providers:index"]; |
|
92
|
|
|
$tableContents[] = ["title" => "Providers > ApplicationProviderInterface", "page" => "provider:application"]; |
|
93
|
|
|
$tableContents[] = ["title" => "Providers > BreadcrumbsProviderInterface", "page" => "provider:breadcrumbs"]; |
|
94
|
|
|
$tableContents[] = ["title" => "Providers > NavigationsProviderInterface", "page" => "provider:navigation"]; |
|
95
|
|
|
|
|
96
|
|
|
// Return the table of contents. |
|
97
|
|
|
return $tableContents; |
|
98
|
|
|
} |
|
99
|
|
|
|
|
100
|
|
|
} |
|
101
|
|
|
|