From 4148912b82da1dd00c1ac34ce27abab5ce6348f4 Mon Sep 17 00:00:00 2001 From: Qiang Xue Date: Fri, 27 Dec 2013 10:46:13 -0500 Subject: [PATCH] Fixes #1643: Added default value for `Captcha::options` --- apps/advanced/frontend/views/site/contact.php | 1 - apps/basic/views/site/contact.php | 1 - framework/CHANGELOG.md | 1 + framework/yii/captcha/Captcha.php | 4 ++++ 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/advanced/frontend/views/site/contact.php b/apps/advanced/frontend/views/site/contact.php index 17c4f79..9aa98e6 100644 --- a/apps/advanced/frontend/views/site/contact.php +++ b/apps/advanced/frontend/views/site/contact.php @@ -26,7 +26,6 @@ $this->params['breadcrumbs'][] = $this->title; field($model, 'subject') ?> field($model, 'body')->textArea(['rows' => 6]) ?> field($model, 'verifyCode')->widget(Captcha::className(), [ - 'options' => ['class' => 'form-control'], 'template' => '
{image}
{input}
', ]) ?>
diff --git a/apps/basic/views/site/contact.php b/apps/basic/views/site/contact.php index d2e59af..ebd148e 100644 --- a/apps/basic/views/site/contact.php +++ b/apps/basic/views/site/contact.php @@ -34,7 +34,6 @@ $this->params['breadcrumbs'][] = $this->title; field($model, 'subject') ?> field($model, 'body')->textArea(['rows' => 6]) ?> field($model, 'verifyCode')->widget(Captcha::className(), [ - 'options' => ['class' => 'form-control'], 'template' => '
{image}
{input}
', ]) ?>
diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index 6991525..747e59d 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -39,6 +39,7 @@ Yii Framework 2 Change Log - Enh: Support for file aliases in console command 'message' (omnilight) - Enh: Sort and Pagination can now create absolute URLs (cebe) - Chg #1610: `Html::activeCheckboxList()` and `Html::activeRadioList()` will submit an empty string if no checkbox/radio is selected (qiangxue) +- Chg #1643: Added default value for `Captcha::options` (qiangxue) - Chg: Renamed `yii\jui\Widget::clientEventsMap` to `clientEventMap` (qiangxue) - Chg: Renamed `ActiveRecord::getPopulatedRelations()` to `getRelatedRecords()` (qiangxue) - Chg: Renamed `attributeName` and `className` to `targetAttribute` and `targetClass` for `UniqueValidator` and `ExistValidator` (qiangxue) diff --git a/framework/yii/captcha/Captcha.php b/framework/yii/captcha/Captcha.php index 18b8765..9e69b9e 100644 --- a/framework/yii/captcha/Captcha.php +++ b/framework/yii/captcha/Captcha.php @@ -48,6 +48,10 @@ class Captcha extends InputWidget * while `{input}` will be replaced with the text input tag. */ public $template = '{image} {input}'; + /** + * @var array the HTML attributes for the input tag. + */ + public $options = ['class' => 'form-control']; /** * Initializes the widget.