Issues (3)

src/views/layouts/_navigation.php (1 issue)

Labels
Severity
1
<?php
2
3
use hiqdev\thememanager\menus\AbstractMainMenu;
4
use yii\bootstrap\Html;
5
use yii\widgets\Menu;
6
7
$isHome = Yii::$app->themeManager->isHomePage();
0 ignored issues
show
The method isHomePage() does not exist on null. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

7
$isHome = Yii::$app->themeManager->/** @scrutinizer ignore-call */ isHomePage();

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
8
if ($isHome) {
9
    $this->registerJs("
10
        // Highlight the top nav as scrolling occurs
11
        $('body').scrollspy({
12
            target: '.navbar-fixed-top',
13
            offset: 51
14
        });
15
        // Offset for Main Navigation
16
        $('#mainNav').affix({
17
            offset: {
18
                top: 100
19
            }
20
        })
21
    ");
22
}
23
24
?>
25
<nav id="mainNav" class="navbar navbar-default navbar-custom navbar-fixed-top <?= (!$isHome) ? 'affix' : '' ?>">
26
    <div class="container">
27
        <!-- Brand and toggle get grouped for better mobile display -->
28
        <div class="navbar-header page-scroll">
29
            <button type="button" class="navbar-toggle" data-toggle="collapse"
30
                    data-target="#bs-example-navbar-collapse-1">
31
                <span class="sr-only">Toggle navigation</span> <?= Yii::t('hiqdev:themes:agency', 'Menu') ?>&nbsp;&nbsp;<i
32
                    class="fa fa-bars"></i>
33
            </button>
34
            <?= Html::a(Yii::t('hiqdev:themes:agency', Yii::$app->name), '#page-top', ['class' => 'navbar-brand page-scroll']) ?>
35
        </div>
36
37
        <!-- Collect the nav links, forms, and other content for toggling -->
38
        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
39
            <?= AbstractMainMenu::widget([], [
40
                'class' => Menu::class,
41
                'options' => ['class' => 'nav navbar-nav navbar-right'],
42
                'linkTemplate' => '<a href="{url}" class="page-scroll">{label}</a>',
43
            ]) ?>
44
        </div>
45
    </div>
46
</nav>
47