dev-master
9999999-devWidgets for nifty theme (Alert, Menu)
MIT
The Requires
- yiisoft/yii2 >=2.0.15
- bower-asset/js-cookie ~2.1.0
by bscheshir
yii2 widget nifty
Widgets for nifty theme (Alert, Menu)
The preferred way to install this extension is through composer., (*1)
add, (*2)
"bscheshirwork/yii2-nifty-widgets": "@dev"
to the require section of your composer.json
file., (*3)
<?= \bscheshirwork\nifty\Menu::widget([ 'iconClassPrefix' => 'pli-', 'collapseTemplate' => '<a href="{url}">{icon} <span class="menu-title">{label}</span> <i class="arrow"></i></a>', 'defaultIconHtml' => '', 'linkTemplate' => '<a href="{url}">{icon} <span class="menu-title">{label}</span></a>', 'activateParents' => false, 'activeCssClass' => 'active-link', 'items' => \yii\helpers\ArrayHelper::merge($favouriteMenuItems, $menuItems), 'options' => [ 'id' => 'mainnav-menu', 'class' => 'list-group', ] ]); ?>
Add in layout, (*4)
<?= \bscheshirwork\nifty\FlashAlerts::widget([ 'errorIcon' => '<i class="fa fa-warning"></i>', 'successIcon' => '<i class="fa fa-check"></i>', 'successTitle' => 'Done!', 'closable' => true, 'encode'=> false, 'bold'=> false, ]); ?>
And set flash messages anywhere, (*5)
Yii::$app->session->setFlash('info1','Message1'); Yii::$app->session->setFlash('info2','Message2'); Yii::$app->session->setFlash('info3','Message3'); Yii::$app->session->setFlash('success-first','Message'); Yii::$app->session->setFlash('success-second','Message');
You can add translation to main config, (*6)
'components' => [ 'i18n' => [ 'translations' => [ '*' => [ 'class' => \yii\i18n\PhpMessageSource::class, 'basePath' => '@common/messages', ], 'app' => [ 'class' => \yii\i18n\PhpMessageSource::class, 'basePath' => '@common/messages', ], 'nifty' => [ 'class' => \yii\i18n\PhpMessageSource::class, 'basePath' => '@vendor/bscheshirwork/yii2-nifty-widgets/messages', ], ], ], ],
You can add generators to main-local config, (*7)
$config['modules']['gii'] = [ 'class' => 'yii\gii\Module', 'generators' => [ 'model' => [ // generator name 'class' => \bscheshirwork\nifty\generators\model\Generator::class, 'templates' => [ 'default' => '@bscheshirwork/nifty/generators/model/nifty', // template name => alias + path to template ], ], 'crud' => [ 'class' => \bscheshirwork\nifty\generators\crud\Generator::class, 'templates' => [ 'default' => '@bscheshirwork/nifty/generators/crud/nifty', ], ], ], ];
Widgets for nifty theme (Alert, Menu)
MIT
yii2 widget nifty