-
Notifications
You must be signed in to change notification settings - Fork 0
/
ActiveField.php
39 lines (34 loc) · 1.1 KB
/
ActiveField.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
<?php
/**
* ActiveField
*
*@package vendor.tangniyuqi.yii2-zui
*@author tangming <[email protected]>
*@copyright DNA <http://www.Noooya.com/>
*@version 1.0.0
*@since 2017-05-18 Create
*@todo N/A
*/
namespace tangniyuqi\zui;
use yii\helpers\Html;
class ActiveField extends \yii\bootstrap\ActiveField
{
/**
* 根据bootstrap3 form-control-static 设置一个form field 静态文本
* A radio button list is like a checkbox list, except that it only allows single selection.
* @param array $options options (name => config) for the radio button list.
* @return $this the field object itself
*/
public function staticInput($options = [])
{
if (!isset($options['value'])) {
$value = Html::getAttributeValue($this->model, $this->attribute);
} else {
$value = $options['value'];
unset($options['value']);
}
if(!isset($options['class'])) $options['class'] = 'form-control-static';
$this->parts['{input}'] = Html::tag('p', $value, $options );
return $this;
}
}