From 83dfce63b88066c608caa1d6b9cf2a0baf43cb10 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Sun, 12 Jan 2014 20:24:23 +0400 Subject: [PATCH] fixes #1888: updated Alert phpdoc --- apps/advanced/frontend/widgets/Alert.php | 14 +++++++------- extensions/bootstrap/Alert.php | 19 ++++++++++--------- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/apps/advanced/frontend/widgets/Alert.php b/apps/advanced/frontend/widgets/Alert.php index 390f359..4af0031 100644 --- a/apps/advanced/frontend/widgets/Alert.php +++ b/apps/advanced/frontend/widgets/Alert.php @@ -27,11 +27,11 @@ class Alert extends \yii\bootstrap\Widget * - $value is the bootstrap alert type (i.e. danger, success, info, warning) */ public $alertTypes = [ - 'error' => 'danger', - 'danger' => 'danger', - 'success' => 'success', - 'info' => 'info', - 'warning' => 'warning' + 'error' => 'alert-danger', + 'danger' => 'alert-danger', + 'success' => 'alert-success', + 'info' => 'alert-info', + 'warning' => 'alert-warning' ]; /** @@ -49,7 +49,7 @@ class Alert extends \yii\bootstrap\Widget foreach ($flashes as $type => $message) { /* 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 */ $this->options['id'] = $this->getId() . '-' . $type; @@ -57,7 +57,7 @@ class Alert extends \yii\bootstrap\Widget echo \yii\bootstrap\Alert::widget([ 'body' => $message, 'closeButton' => $this->closeButton, - 'options' => $this->options + 'options' => $this->options, ]); $session->removeFlash($type); diff --git a/extensions/bootstrap/Alert.php b/extensions/bootstrap/Alert.php index 29844bd..15b3342 100644 --- a/extensions/bootstrap/Alert.php +++ b/extensions/bootstrap/Alert.php @@ -18,11 +18,10 @@ use yii\helpers\Html; * * ```php * echo Alert::widget([ - * 'body' => 'Say hello...', - * 'closeButton' => [ - * 'label' => '×', - * 'tag' => 'a', + * 'options' => [ + * 'class' => 'alert-info', * ], + * 'body' => 'Say hello...', * ]); * ``` * @@ -31,7 +30,9 @@ use yii\helpers\Html; * * ```php * Alert::begin([ - * 'closeButton' => ['label' => '×'], + * 'options' => [ + * 'class' => 'alert-warning', + * ], * ]); * * echo 'Say hello...'; @@ -39,7 +40,7 @@ use yii\helpers\Html; * Alert::end(); * ``` * - * @see http://twitter.github.io/bootstrap/javascript.html#alerts + * @see http://getbootstrap.com/components/#alerts * @author Antonio Ramirez * @since 2.0 */ @@ -62,7 +63,7 @@ class Alert extends Widget * - 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. - * 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. */ public $closeButton = []; @@ -134,9 +135,9 @@ class Alert extends Widget */ protected function initOptions() { - $this->options = array_merge(['class' => 'fade in'], $this->options); - Html::addCssClass($this->options, 'alert'); + Html::addCssClass($this->options, 'fade'); + Html::addCssClass($this->options, 'in'); if ($this->closeButton !== null) { $this->closeButton = array_merge([