-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFnActiveForm.php
50 lines (41 loc) · 1015 Bytes
/
FnActiveForm.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
/**
* @link http://foundationize.com
* @package shqear/yii2-foundation6
* @version dev
*/
namespace shqear\foundation6;
use Yii;
use yii\base\InvalidConfigException;
use yii\helpers\Html;
class FnActiveForm extends \yii\widgets\ActiveForm
{
public $fieldClass = 'shqear\foundation6\FnActiveField';
public $layout = 'default';
/**
* Override default settings for form
*/
//public $errorCssClass = 'form-error';
/**
* @inheritdoc
*/
public function init()
{
if (!in_array($this->layout, ['default', 'inline'])) {
throw new InvalidConfigException('Invalid layout type: ' . $this->layout);
}
if ($this->layout !== 'default') {
Html::addCssClass($this->options, 'form-' . $this->layout);
}
parent::init();
}
/**
* @inheritdoc
*/
public function run()
{
parent::run();
$view = $this->getView();
ActiveFormAsset::register($view);
}
}