Skip to content

Commit c332906

Browse files
committed
1.0.1
Added support for yii\bootstrap\ActiveForm
1 parent 0d5800d commit c332906

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

src/ActiveForm.php

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Yii;
1515
use yii\base\InvalidCallException;
16+
use yii\base\InvalidConfigException;
1617
use yii\helpers\Html;
1718
use yii\helpers\Json;
1819
use yii\widgets\ActiveFormAsset;
@@ -33,7 +34,7 @@
3334
*
3435
* ~~~
3536
*
36-
* @version 1.0.0
37+
* @version 1.0.1
3738
*
3839
* @author lichunqiang <light-li@hotmail.com>
3940
*/
@@ -47,6 +48,27 @@ class ActiveForm extends \yii\widgets\ActiveForm
4748
* @var array The options passed to jquery.form, Please see the jquery.form document
4849
*/
4950
public $ajaxSubmitOptions = [];
51+
/**
52+
* @var string For `yii\bootstrap\ActiveForm` compatibility.
53+
*/
54+
public $layout;
55+
56+
/**
57+
* @inheritdoc
58+
*/
59+
public function init()
60+
{
61+
if ($this->layout) {
62+
if (!in_array($this->layout, ['default', 'horizontal', 'inline'])) {
63+
throw new InvalidConfigException('Invalid layout type: ' . $this->layout);
64+
}
65+
if ($this->layout !== 'default') {
66+
Html::addCssClass($this->options, 'form-' . $this->layout);
67+
}
68+
}
69+
70+
parent::init();
71+
}
5072

5173
/**
5274
* {@inheritdoc}

src/AjaxFormAsset.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
/**
1717
* jquery.form.js asset bundle.
1818
*
19-
* @version 1.0.0
19+
* @version 1.0.1
2020
*
2121
* @author lichunqiang <ligith-li@hotmail.com>
2222
*

0 commit comments

Comments
 (0)