-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 49d6ae2
Showing
3 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
namespace edoriansyah\alert; | ||
use Yii; | ||
class Alert extends \yii\bootstrap\Widget | ||
{ | ||
public function init() | ||
{ | ||
parent::init(); | ||
if(Yii::$app->session->hasFlash('success')){ | ||
echo '<div class="alert alert-success">'; | ||
echo Yii::$app->session->getFlash('success'); | ||
echo '</div>'; | ||
}else if (Yii::$app->session->hasFlash('error')){ | ||
echo '<div class="alert alert-danger">'; | ||
echo Yii::$app->session->getFlash('error'); | ||
echo '</div>'; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
yii2-alert-nf | ||
============= | ||
Widget Alert twitter bootstrap for Yii Framework 2 | ||
|
||
Installation | ||
------------ | ||
|
||
The preferred way to install this extension is through [composer](http://getcomposer.org/download/). | ||
|
||
Either run | ||
|
||
``` | ||
php composer.phar require --prefer-dist edoriansyah/yii2-alert-nf "*" | ||
``` | ||
|
||
or add | ||
|
||
``` | ||
"edoriansyah/yii2-alert-nf": "*" | ||
``` | ||
|
||
to the require section of your `composer.json` file. | ||
|
||
|
||
Usage | ||
----- | ||
|
||
Once the extension is installed, simply use it in your code by : | ||
|
||
```php | ||
<?= \edoriansyah\alert\AutoloadExample::widget(); ?>``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"name": "edoriansyah/yii2-alert-nf", | ||
"description": "Widget Alert twitter bootstrap for Yii Framework 2", | ||
"type": "yii2-extension", | ||
"keywords": ["yii2","extension","alert"], | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Edo Riansyah", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"require": { | ||
"yiisoft/yii2": "*" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"edoriansyah\\alert\\": "" | ||
} | ||
} | ||
} |