-
Notifications
You must be signed in to change notification settings - Fork 0
/
Html.php
73 lines (51 loc) · 1.93 KB
/
Html.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
namespace denis909\yii;
use yii\helpers\ArrayHelper;
class Html extends \yii\helpers\Html
{
static $submitButtonOptions = ['class' => 'btn btn-primary'];
static $cancelButtonOptions = ['class' => 'btn btn-secondary'];
static $saveButtonOptions = ['class' => 'btn btn-light'];
static $textInputOptions = ['class' => 'form-control'];
static $dropdownListOptions = ['class' => 'form-control'];
public static function activeTextInput($model, $attribute, $options = []) : string
{
$options = ArrayHelper::merge(static::$textInputOptions, $options);
return parent::activeTextInput($model, $attribute, $options);
}
public static function activeDropdownList($model, $attribute, $list = [], $options = []) : string
{
$options = ArrayHelper::merge(static::$textInputOptions, $options);
return parent::activeDropdownList($model, $attribute, $list, $options);
}
public static function submitButton($content = null, $options = [])
{
if (!$content)
{
$content = Yii::t('app', 'Submit');
}
$options = ArrayHelper::merge(static::$submitButtonOptions, $options);
return parent::submitButton($content, $options);
}
public static function cancelButton($content = null, $options = [])
{
if (!$content)
{
$content = Yii::t('app', 'Cancel');
}
$options = ArrayHelper::merge(static::$cancelButtonOptions, $options);
return parent::cancelButton($content, $options);
}
public static function saveButton($content = null, $options = [])
{
if (!$content)
{
$content = Yii::t('app', 'Save');
}
$options = ArrayHelper::merge(static::$saveButtonOptions, [
'name' => 'action',
'value' => 'save'
], $options);
return parent::submitButton($content, $options);
}
}