|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
use app\assets\AppAsset; |
|
4
|
|
|
use yii\bootstrap\Nav; |
|
5
|
|
|
use yii\bootstrap\NavBar; |
|
6
|
|
|
use yii\helpers\Html; |
|
7
|
|
|
use yii\widgets\Breadcrumbs; |
|
8
|
|
|
use yii\widgets\Menu; |
|
9
|
|
|
use yii2mod\notify\BootstrapNotify; |
|
10
|
|
|
|
|
11
|
|
|
/* @var $this \yii\web\View */ |
|
12
|
|
|
/* @var $content string */ |
|
13
|
|
|
|
|
14
|
|
|
AppAsset::register($this); |
|
15
|
|
|
?> |
|
16
|
|
|
<?php $this->beginPage(); ?> |
|
17
|
|
|
<!DOCTYPE html> |
|
18
|
|
|
<html lang="<?php echo Yii::$app->language; ?>"> |
|
19
|
|
|
<head> |
|
20
|
|
|
<?php $this->registerMetaTag(['charset' => Yii::$app->charset]); ?> |
|
21
|
|
|
<?php $this->registerMetaTag(['name' => 'viewport', 'content' => 'width=device-width, initial-scale=1']); ?> |
|
22
|
|
|
<?php echo Html::csrfMetaTags(); ?> |
|
23
|
|
|
<title><?php echo implode(' | ', array_filter([Html::encode($this->title), Yii::$app->name])); ?></title> |
|
24
|
|
|
<?php $this->head(); ?> |
|
25
|
|
|
</head> |
|
26
|
|
|
<body> |
|
27
|
|
|
<?php $this->beginBody(); ?> |
|
28
|
|
|
<?php echo BootstrapNotify::widget(); ?> |
|
29
|
|
|
<div class="wrap"> |
|
30
|
|
|
<?php NavBar::begin([ |
|
31
|
|
|
'brandLabel' => Yii::$app->name, |
|
32
|
|
|
'brandUrl' => Yii::$app->homeUrl, |
|
33
|
|
|
'options' => [ |
|
34
|
|
|
'class' => 'navbar-inverse navbar-fixed-top', |
|
35
|
|
|
], |
|
36
|
|
|
]); |
|
37
|
|
|
$menuItems = [ |
|
38
|
|
|
['label' => 'Home', 'url' => ['/site/index']], |
|
39
|
|
|
['label' => 'About Us', 'url' => ['/about-us'], 'active' => Yii::$app->getRequest()->pathInfo == 'about-us'], |
|
40
|
|
|
['label' => 'Contact', 'url' => ['/site/contact']], |
|
41
|
|
|
]; |
|
42
|
|
|
if (Yii::$app->user->isGuest) { |
|
43
|
|
|
$menuItems[] = ['label' => 'Signup', 'url' => ['/site/signup']]; |
|
44
|
|
|
$menuItems[] = ['label' => 'Login', 'url' => ['/site/login']]; |
|
45
|
|
|
} else { |
|
46
|
|
|
$menuItems[] = ['label' => 'My Account', 'url' => ['/site/account']]; |
|
47
|
|
|
$menuItems[] = ['label' => 'Administration', 'url' => ['/admin'], 'visible' => Yii::$app->getUser()->can('admin')]; |
|
|
|
|
|
|
48
|
|
|
$menuItems[] = '<li>' |
|
49
|
|
|
. Html::beginForm(['/site/logout'], 'post') |
|
50
|
|
|
. Html::submitButton( |
|
51
|
|
|
'Logout (' . Yii::$app->user->identity->username . ')', |
|
52
|
|
|
['class' => 'btn btn-link'] |
|
53
|
|
|
) |
|
54
|
|
|
. Html::endForm() |
|
55
|
|
|
. '</li>'; |
|
56
|
|
|
} |
|
57
|
|
|
echo Nav::widget([ |
|
58
|
|
|
'options' => ['class' => 'navbar-nav navbar-right'], |
|
59
|
|
|
'items' => $menuItems, |
|
60
|
|
|
]); |
|
61
|
|
|
NavBar::end(); |
|
62
|
|
|
?> |
|
63
|
|
|
<div class="container"> |
|
64
|
|
|
<?php echo Breadcrumbs::widget([ |
|
65
|
|
|
'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [], |
|
66
|
|
|
]); ?> |
|
67
|
|
|
<?php echo $content; ?> |
|
68
|
|
|
</div> |
|
69
|
|
|
</div> |
|
70
|
|
|
|
|
71
|
|
|
<footer class="footer"> |
|
72
|
|
|
<div class="container"> |
|
73
|
|
|
<p class="pull-left">© <?php echo Yii::$app->name . ' ' . date('Y'); ?></p> |
|
74
|
|
|
<?php echo Menu::widget([ |
|
75
|
|
|
'items' => [ |
|
76
|
|
|
['label' => 'Terms & Conditions', 'url' => ['/terms-and-conditions']], |
|
77
|
|
|
['label' => 'Privacy Policy', 'url' => ['/privacy-policy']], |
|
78
|
|
|
], |
|
79
|
|
|
]); |
|
80
|
|
|
?> |
|
81
|
|
|
</div> |
|
82
|
|
|
</footer> |
|
83
|
|
|
|
|
84
|
|
|
<?php $this->endBody(); ?> |
|
85
|
|
|
</body> |
|
86
|
|
|
</html> |
|
87
|
|
|
<?php $this->endPage(); ?> |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: