Commit a3ab453a authored by Qiang Xue's avatar Qiang Xue

Fixes #3240: Added support for assigning an anonymous function to...

Fixes #3240: Added support for assigning an anonymous function to `yii\widgets\ActiveForm::fieldConfig`
parent 309415f1
...@@ -65,6 +65,11 @@ use yii\base\InvalidConfigException; ...@@ -65,6 +65,11 @@ use yii\base\InvalidConfigException;
*/ */
class ActiveForm extends \yii\widgets\ActiveForm class ActiveForm extends \yii\widgets\ActiveForm
{ {
/**
* @var string the default field class name when calling [[field()]] to create a new field.
* @see fieldConfig
*/
public $fieldClass = 'yii\bootstrap\ActiveField';
/** /**
* @var array HTML attributes for the form tag. Default is `['role' => 'form']`. * @var array HTML attributes for the form tag. Default is `['role' => 'form']`.
*/ */
...@@ -91,9 +96,6 @@ class ActiveForm extends \yii\widgets\ActiveForm ...@@ -91,9 +96,6 @@ class ActiveForm extends \yii\widgets\ActiveForm
if ($this->layout !== 'default') { if ($this->layout !== 'default') {
Html::addCssClass($this->options, 'form-' . $this->layout); Html::addCssClass($this->options, 'form-' . $this->layout);
} }
if (!isset($this->fieldConfig['class'])) {
$this->fieldConfig['class'] = ActiveField::className();
}
parent::init(); parent::init();
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment