Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bscheshirwork/yii2-nifty-widgets
Widgets for nifty theme (Alert, Menu)
https://github.com/bscheshirwork/yii2-nifty-widgets
Last synced: about 15 hours ago
JSON representation
Widgets for nifty theme (Alert, Menu)
- Host: GitHub
- URL: https://github.com/bscheshirwork/yii2-nifty-widgets
- Owner: bscheshirwork
- Created: 2018-07-24T10:22:52.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-03-12T08:33:48.000Z (almost 6 years ago)
- Last Synced: 2024-11-06T11:03:27.885Z (2 months ago)
- Language: PHP
- Size: 25.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Widgets for nifty theme
* Menu-widget
* Flash-Alerts## Installation
The preferred way to install this extension is through [composer](http://getcomposer.org/download/).
add
```
"bscheshirwork/yii2-nifty-widgets": "@dev"
```to the require section of your `composer.json` file.
## Usage
* Menu
```php
= \bscheshirwork\nifty\Menu::widget([
'iconClassPrefix' => 'pli-',
'collapseTemplate' => '{icon} ',
'defaultIconHtml' => '',
'linkTemplate' => '{icon} ',
'activateParents' => false,
'activeCssClass' => 'active-link',
'items' => \yii\helpers\ArrayHelper::merge($favouriteMenuItems, $menuItems),
'options' => [
'id' => 'mainnav-menu',
'class' => 'list-group',
]
]); ?>
```* FlashAlert
Add in layout
```php
= \bscheshirwork\nifty\FlashAlerts::widget([
'errorIcon' => '',
'successIcon' => '',
'successTitle' => 'Done!',
'closable' => true,
'encode'=> false,
'bold'=> false,
]); ?>
```And set flash messages anywhere
```php
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
```php
'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
```php
$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',
],
],
],
];
```