public function navlist()
{
return _class('html')->navlist([
'brand' => [
'link' => url('/'),
'name' => 'Title',
],
[
'link' => url('/home'),
'name' => 'Home',
],
[
'link' => url('/link1'),
'name' => 'Link1',
],
[
'link' => url('/link2'),
'name' => 'Link2',
],
]);
}
public function navlist($data = [], $extra = [])
{
$extra['id'] = $extra['id'] ?: __FUNCTION__ . '_' . ++$this->_ids[__FUNCTION__];
$items = [];
foreach ((array) $data as $k => $v) {
if ( ! is_array($v)) {
$name = $v;
$link = $k;
$v = [];
} else {
$name = $v['name'];
$link = $v['link'];
}
$class_item = $v['class_item'] ?: $extra['class_item'];
$badge = $v['badge'] ? ' <sup class="badge badge-' . ($v['class_badge'] ?: 'info') . '">' . $v['badge'] . '</sup>' : '';
$items[] = '<li class="' . ($class_item ? ' ' . $class_item : '') . '"><a href="' . $link . '"><i class="icon-chevron-right fa fa-chevron-right"></i> ' . t($name) . $badge . '</a></li>';
}
return '<div class="bs-docs-sidebar"><ul class="nav nav-list bs-docs-sidenav' . ($extra['class'] ? ' ' . $extra['class'] : '') . '" id="' . $extra['id'] . '">' . implode(PHP_EOL, (array) $items) . '</ul></div>';
}
Navlist plugin is custom markup for menu-like lists