Skip to content

Commit 617ce84

Browse files
committed
2 parents 3ab7067 + 0fe177b commit 617ce84

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

src/Helpers/menu_helper.php

+26-26
Original file line numberDiff line numberDiff line change
@@ -84,44 +84,44 @@ function nest($item, $parent_id)
8484
}
8585

8686
/**
87-
* The ugly for generate some html
88-
*
87+
* The ugly for generate some html.
88+
*
8989
* return string hrml
9090
*/
9191
if (!function_exists('build')) {
92-
function build() {
93-
92+
function build()
93+
{
9494
$html = '';
9595
foreach (menu() as $parent) {
9696
$open = current_url() == base_url($parent->route) || in_array(uri_string(), array_column($parent->children, 'route')) ? 'menu-open' : '';
9797
$active = current_url() == base_url($parent->route) || in_array(uri_string(), array_column($parent->children, 'route')) ? 'active' : '';
9898
$link = base_url($parent->route);
9999

100100
$html .= "<li class='nav-item has-treeview {$open}'>";
101-
$html .= "<a href='{$link}' class='nav-link {$active}'>";
102-
$html .= "<i class='nav-icon {$parent->icon}'></i>";
103-
$html .= '<p>';
104-
$html .= $parent->title;
105-
if (count($parent->children)) {
106-
$html .= "<i class='right fas fa-angle-left'></i>";
107-
}
108-
$html .= '</p>';
109-
$html .= '</a>';
110-
if (count($parent->children)) {
101+
$html .= "<a href='{$link}' class='nav-link {$active}'>";
102+
$html .= "<i class='nav-icon {$parent->icon}'></i>";
103+
$html .= '<p>';
104+
$html .= $parent->title;
105+
if (count($parent->children)) {
106+
$html .= "<i class='right fas fa-angle-left'></i>";
107+
}
108+
$html .= '</p>';
109+
$html .= '</a>';
110+
if (count($parent->children)) {
111111
$html .= "<ul class='nav nav-treeview'>";
112-
foreach ($parent->children as $child) {
113-
$link_child = base_url($child->route);
114-
$active_child = current_url() == base_url($child->route) ? 'active' : '';
115-
$html .= "<li class='nav-item has-treeview'>";
116-
$html .= "<a href='{$link_child}'";
117-
$html .= "class='nav-link {$active_child}'>";
118-
$html .= "<i class='nav-icon {$child->icon}'></i>";
119-
$html .= "<p>{$child->title}</p>";
120-
$html .= '</a>';
121-
$html .= '</li>';
122-
}
123-
$html .= '</ul>';
112+
foreach ($parent->children as $child) {
113+
$link_child = base_url($child->route);
114+
$active_child = current_url() == base_url($child->route) ? 'active' : '';
115+
$html .= "<li class='nav-item has-treeview'>";
116+
$html .= "<a href='{$link_child}'";
117+
$html .= "class='nav-link {$active_child}'>";
118+
$html .= "<i class='nav-icon {$child->icon}'></i>";
119+
$html .= "<p>{$child->title}</p>";
120+
$html .= '</a>';
121+
$html .= '</li>';
124122
}
123+
$html .= '</ul>';
124+
}
125125
$html .= '</li>';
126126
}
127127

0 commit comments

Comments
 (0)