public function breadcrumbs()
{
return _class('html')->breadcrumbs([
[
'link' => url('/home'),
'name' => 'Home',
],
[
'link' => url('/library'),
'name' => 'Library',
],
[
'name' => 'Data',
],
]);
}
public function breadcrumbs($data = [], $extra = [])
{
$extra['id'] = $extra['id'] ?: __FUNCTION__ . '_' . ++$this->_ids[__FUNCTION__];
$items = [];
$divider = $extra['divider'] ?: ''; // '/'
$show_divider = ! $this->_is_bs3 && strlen($divider);
$len = count((array) $data);
$data = _prepare_html($data);
foreach ((array) $data as $k => $v) {
$is_last = (++$i == $len);
$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="' . ($is_last ? ' active' : '') . ($class_item ? ' ' . $class_item : '') . '">
' . (
($is_last || ! $v['link']) ? $v['name']
: '<a href="' . $v['link'] . '" title="' . $v['name'] . '">' . $v['name'] . $badge . '</a>' . ($show_divider ? ' <span class="divider">' . $divider . '</span>' : '')
) . '
</li>';
}
$tag = $this->_is_bs3 ? 'ol' : 'ul';
return '<' . $tag . ' class="breadcrumb' . ($extra['class'] ? ' ' . $extra['class'] : '') . '" id="' . $extra['id'] . '"">' . implode(PHP_EOL, (array) $items) . '</' . $tag . '>';
}