Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
83dfce63
Commit
83dfce63
authored
Jan 12, 2014
by
Alexander Makarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixes #1888: updated Alert phpdoc
parent
51cb9216
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
16 deletions
+17
-16
Alert.php
apps/advanced/frontend/widgets/Alert.php
+7
-7
Alert.php
extensions/bootstrap/Alert.php
+10
-9
No files found.
apps/advanced/frontend/widgets/Alert.php
View file @
83dfce63
...
@@ -27,11 +27,11 @@ class Alert extends \yii\bootstrap\Widget
...
@@ -27,11 +27,11 @@ class Alert extends \yii\bootstrap\Widget
* - $value is the bootstrap alert type (i.e. danger, success, info, warning)
* - $value is the bootstrap alert type (i.e. danger, success, info, warning)
*/
*/
public
$alertTypes
=
[
public
$alertTypes
=
[
'error'
=>
'danger'
,
'error'
=>
'
alert-
danger'
,
'danger'
=>
'danger'
,
'danger'
=>
'
alert-
danger'
,
'success'
=>
'success'
,
'success'
=>
'
alert-
success'
,
'info'
=>
'info'
,
'info'
=>
'
alert-
info'
,
'warning'
=>
'warning'
'warning'
=>
'
alert-
warning'
];
];
/**
/**
...
@@ -49,7 +49,7 @@ class Alert extends \yii\bootstrap\Widget
...
@@ -49,7 +49,7 @@ class Alert extends \yii\bootstrap\Widget
foreach
(
$flashes
as
$type
=>
$message
)
{
foreach
(
$flashes
as
$type
=>
$message
)
{
/* initialize css class for each alert box */
/* initialize css class for each alert box */
$this
->
options
[
'class'
]
=
'alert-'
.
$this
->
alertTypes
[
$type
]
.
$appendCss
;
$this
->
options
[
'class'
]
=
$this
->
alertTypes
[
$type
]
.
$appendCss
;
/* assign unique id to each alert box */
/* assign unique id to each alert box */
$this
->
options
[
'id'
]
=
$this
->
getId
()
.
'-'
.
$type
;
$this
->
options
[
'id'
]
=
$this
->
getId
()
.
'-'
.
$type
;
...
@@ -57,7 +57,7 @@ class Alert extends \yii\bootstrap\Widget
...
@@ -57,7 +57,7 @@ class Alert extends \yii\bootstrap\Widget
echo
\yii\bootstrap\Alert
::
widget
([
echo
\yii\bootstrap\Alert
::
widget
([
'body'
=>
$message
,
'body'
=>
$message
,
'closeButton'
=>
$this
->
closeButton
,
'closeButton'
=>
$this
->
closeButton
,
'options'
=>
$this
->
options
'options'
=>
$this
->
options
,
]);
]);
$session
->
removeFlash
(
$type
);
$session
->
removeFlash
(
$type
);
...
...
extensions/bootstrap/Alert.php
View file @
83dfce63
...
@@ -18,11 +18,10 @@ use yii\helpers\Html;
...
@@ -18,11 +18,10 @@ use yii\helpers\Html;
*
*
* ```php
* ```php
* echo Alert::widget([
* echo Alert::widget([
* 'body' => 'Say hello...',
* 'options' => [
* 'closeButton' => [
* 'class' => 'alert-info',
* 'label' => '×',
* 'tag' => 'a',
* ],
* ],
* 'body' => 'Say hello...',
* ]);
* ]);
* ```
* ```
*
*
...
@@ -31,7 +30,9 @@ use yii\helpers\Html;
...
@@ -31,7 +30,9 @@ use yii\helpers\Html;
*
*
* ```php
* ```php
* Alert::begin([
* Alert::begin([
* 'closeButton' => ['label' => '×'],
* 'options' => [
* 'class' => 'alert-warning',
* ],
* ]);
* ]);
*
*
* echo 'Say hello...';
* echo 'Say hello...';
...
@@ -39,7 +40,7 @@ use yii\helpers\Html;
...
@@ -39,7 +40,7 @@ use yii\helpers\Html;
* Alert::end();
* Alert::end();
* ```
* ```
*
*
* @see http://
twitter.github.io/bootstrap/javascript.html
#alerts
* @see http://
getbootstrap.com/components/
#alerts
* @author Antonio Ramirez <amigo.cobos@gmail.com>
* @author Antonio Ramirez <amigo.cobos@gmail.com>
* @since 2.0
* @since 2.0
*/
*/
...
@@ -62,7 +63,7 @@ class Alert extends Widget
...
@@ -62,7 +63,7 @@ class Alert extends Widget
* - label: string, the label of the button. Defaults to '×'.
* - label: string, the label of the button. Defaults to '×'.
*
*
* The rest of the options will be rendered as the HTML attributes of the button tag.
* The rest of the options will be rendered as the HTML attributes of the button tag.
* Please refer to the [Alert
plugin help](http://twitter.github.com/bootstrap/javascript.html
#alerts)
* Please refer to the [Alert
documentation](http://getbootstrap.com/components/
#alerts)
* for the supported HTML attributes.
* for the supported HTML attributes.
*/
*/
public
$closeButton
=
[];
public
$closeButton
=
[];
...
@@ -134,9 +135,9 @@ class Alert extends Widget
...
@@ -134,9 +135,9 @@ class Alert extends Widget
*/
*/
protected
function
initOptions
()
protected
function
initOptions
()
{
{
$this
->
options
=
array_merge
([
'class'
=>
'fade in'
],
$this
->
options
);
Html
::
addCssClass
(
$this
->
options
,
'alert'
);
Html
::
addCssClass
(
$this
->
options
,
'alert'
);
Html
::
addCssClass
(
$this
->
options
,
'fade'
);
Html
::
addCssClass
(
$this
->
options
,
'in'
);
if
(
$this
->
closeButton
!==
null
)
{
if
(
$this
->
closeButton
!==
null
)
{
$this
->
closeButton
=
array_merge
([
$this
->
closeButton
=
array_merge
([
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment