2017 © Pedro Peláez
 

yii2-extension yii2-nifty-widgets

Widgets for nifty theme (Alert, Menu)

image

bscheshirwork/yii2-nifty-widgets

Widgets for nifty theme (Alert, Menu)

  • Tuesday, July 24, 2018
  • by bscheshirwork
  • Repository
  • 1 Watchers
  • 0 Stars
  • 4 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Widgets for nifty theme

  • Menu-widget
  • Flash-Alerts

Installation

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)

Usage

  • Menu
<?= \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',
    ]
]); ?>
  • FlashAlert

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');

Translation

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',
                ],
            ],
        ],
    ],

Gii

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',
                ],
            ],
        ],
    ];

The Versions

24/07 2018

dev-master

9999999-dev

Widgets for nifty theme (Alert, Menu)

  Sources   Download

MIT

The Requires

 

by Avatar bscheshir

yii2 widget nifty