-
Notifications
You must be signed in to change notification settings - Fork 2
/
NavBar.php
56 lines (51 loc) · 1.22 KB
/
NavBar.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
namespace artkost\uikit;
use yii\helpers\Html;
/**
* NavBar renders a navbar HTML component.
*
* Any content enclosed between the [[begin()]] and [[end()]] calls of NavBar
* is treated as the content of the navbar. You may use widgets such as [[Nav]]
* or [[\yii\widgets\Menu]] to build up such content. For example,
*
* ```php
* use yii\uikit\NavBar;
* use yii\uikit\Nav;
*
* NavBar::begin();
* echo Nav::widget([
* 'items' => [
* ['label' => 'Home', 'url' => ['/site/index']],
* ['label' => 'About', 'url' => ['/site/about']],
* ],
* ]);
* NavBar::end();
* ```
*
* @see http://www.getuikit.com/docs/navbar.html
* @author Nikolay Kostyurin <[email protected]>
* @since 2.0
*/
class NavBar extends Widget
{
/**
* Initializes the widget.
*/
public function init()
{
parent::init();
$this->clientOptions = false;
Html::addCssClass($this->options, 'uk-navbar');
if (empty($this->options['role'])) {
$this->options['role'] = 'navigation';
}
echo Html::beginTag('nav', $this->options);
}
/**
* Renders the widget.
*/
public function run()
{
echo Html::endTag('nav');
}
}