-
Notifications
You must be signed in to change notification settings - Fork 0
/
ActiveField.php
37 lines (31 loc) · 1.12 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
<?php
/**
* Created by PhpStorm.
* User: yidashi
* Date: 2017/2/11
* Time: 下午9:43
*/
namespace backend\widgets;
use yii\helpers\ArrayHelper;
use yii\helpers\Html;
class ActiveField extends \yii\widgets\ActiveField
{
public function staticControl($options = [])
{
$this->adjustLabelFor($options);
$this->parts['{input}'] = Html::activeStaticControl($this->model, $this->attribute, $options);
return $this;
}
public function suffix($suffix = '', $suffixType = 'addon', $size = 300)
{
$size = !empty($size) ? "input-group-{$size} " : '';
$this->template = "{label}\n<div class=\"input-group $size\">{input}\n<div class=\"input-group-" . $suffixType . "\">" . $suffix . "</div></div>\n{hint}\n{error}";
return $this;
}
public function prefix($prefix = '', $prefixType = 'addon', $size = 300)
{
$size = !empty($size) ? "input-group-{$size} " : '';
$this->template = "{label}\n<div class=\"input-group $size\"><div class=\"input-group-" . $prefixType . "\">" . $prefix . "</div>\n{input}</div>\n{hint}\n{error}";
return $this;
}
}