digitv/yii2bootstrap4

Yii2 Bootstrap 4 widgets

Installs: 2 453

Dependents: 0

Suggesters: 0

Security: 0

Stars: 14

Watchers: 1

Forks: 3

Open Issues: 0

Type:yii2-extension

1.1.2 2018-08-01 07:16 UTC

This package is auto-updated.

Last update: 2024-12-04 21:56:26 UTC


README

Yii2 bootstrap widgets on Bootstrap 4

Those are ported and partially changed yiisoft/yii2-bootstrap widgets to use with Bootstrap v4.

It is using twbs/bootstrap package with Bootstrap v4 CSS/JS.

Use it similarly to yiisoft/yii2-bootstrap package.

Please feel free to create a issue / pull request if I forgot something or if you find some bugs.

Examples:

<?= digitv\bootstrap\widgets\Progress::widget(['percent' => 60, 'label' => 'Test label']) ?>
//Breadcrumbs in layout view
<?= digitv\bootstrap\widgets\Breadcrumbs::widget([
    'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],
]) ?>
<?php
//Navbar in layout view
    digitv\bootstrap\widgets\NavBar::begin([
        'brandLabel' => Yii::$app->name,
        'brandUrl' => Yii::$app->homeUrl,
        'options' => [
            'class' => 'navbar-dark bg-dark navbar-expand-lg fixed-top',
        ],
    ]);
    $menuItems = [
        ['label' => 'Home', 'url' => ['/site/index']],
        ['label' => 'Dropdown', 'url' => ['/site/index'], 'items' => [
            ['label' => 'First', 'url' => ['/site/index']],
            ['label' => 'Second', 'url' => '/'],
        ]],
        ['label' => 'About', 'url' => ['/site/about']],
        ['label' => 'Contact', 'url' => ['/site/contact']],
    ];
    if (Yii::$app->user->isGuest) {
        $menuItems[] = ['label' => 'Signup', 'url' => ['/site/signup']];
        $menuItems[] = ['label' => 'Login', 'url' => ['/site/login']];
    } else {
        $menuItems[] = '<li>'
            . digitv\bootstrap\Html::beginForm(['/site/logout'], 'post')
            . digitv\bootstrap\Html::submitButton(
                'Logout (' . Yii::$app->user->identity->username . ')',
                ['class' => 'btn btn-link logout']
            )
            . digitv\bootstrap\Html::endForm()
            . '</li>';
    }
    echo digitv\bootstrap\widgets\Nav::widget([
        'options' => ['class' => 'navbar-nav ml-auto'],
        'items' => $menuItems,
    ]);
    digitv\bootstrap\widgets\NavBar::end();
?>