#php #yii2
Вопрос:
Я пытаюсь интегрироваться с администратором SB на UI
стороне.
АДМИНИСТРАТОР SB — Начальная загрузка 4
Меню, которое будет сгенерировано, представляет собой массив, полученный из базы данных.
$items = [
0 => [
'label' => 'Home'
'url' => [
0 => '/site/index'
]
]
1 => [
'label' => 'Admin'
'url' => '#'
'items' => [
0 => [
'label' => 'RBAC'
'url' => '#'
'items' => [
0 => [
'label' => 'Assignment'
'url' => [
0 => '/admin/assignment/index'
]
]
1 => [
'label' => 'Menu'
'url' => [
0 => '/admin/menu/index'
]
]
2 => [
'label' => 'Permission'
'url' => [
0 => '/admin/permission/index'
]
]
3 => [
'label' => 'Role'
'url' => [
0 => '/admin/role/index'
]
]
4 => [
'label' => 'Route'
'url' => [
0 => '/admin/route/index'
]
]
5 => [
'label' => 'Rule'
'url' => [
0 => '/admin/rule/index'
]
]
6 => [
'label' => 'User'
'url' => [
0 => '/admin/user/index'
]
]
]
]
]
]
]
Исходная форма самого администратора SB выглядит следующим образом.
<nav class="sb-sidenav accordion sb-sidenav-light" id="sidenavAccordion">
<div class="sb-sidenav-menu">
<div class="nav">
<a class="nav-link" href="index.html">
<div class="sb-nav-link-icon"><i class="fas fa-tachometer-alt"></i></div>
Dashboard
</a>
<a class="nav-link collapsed" href="#" data-toggle="collapse" data-target="#collapseLayouts"
aria-expanded="false" aria-controls="collapseLayouts">
<div class="sb-nav-link-icon"><i class="fas fa-columns"></i></div>
Layouts
<div class="sb-sidenav-collapse-arrow"><i class="fas fa-angle-down"></i></div>
</a>
<div class="collapse" id="collapseLayouts" aria-labelledby="headingOne"
data-parent="#sidenavAccordion">
<nav class="sb-sidenav-menu-nested nav">
<a class="nav-link" href="layout-static.html">Static Navigation</a>
<a class="nav-link" href="layout-sidenav-light.html">Light Sidenav</a>
</nav>
</div>
</div>
</div>
<div class="sb-sidenav-footer">
<div class="small">Logged in as:</div>
<?= Yii::$app->user->identity->username ?>
</div>
</nav>
Now, I use Yii2 style using Nav, the result is that the HTML code doesn’t match, either ‘single link’ or ‘dropdown-link’.
<nav class="sb-sidenav accordion sb-sidenav-light" id="sidenavAccordion">
<div class="sb-sidenav-menu">
<?php
echo yiibootstrap4Nav::widget([
'items' =>$items,
]);
?>
</div>
<div class="sb-sidenav-footer">
<div class="small">Logged in as:</div>
<?= Yii::$app->user->identity->username ?>
</div>
</nav>
Anyone has done wtih this ?
Any help it so appreciated.