1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Yajra\DataTables\Html\Options\Plugins; |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* DataTables - AutoFill plugin option builder. |
7
|
|
|
* |
8
|
|
|
* @see https://datatables.net/extensions/autofill/ |
9
|
|
|
* @see https://datatables.net/reference/option/autoFill |
10
|
|
|
* @see https://datatables.net/reference/option/#autoFill |
11
|
|
|
*/ |
12
|
|
|
trait AutoFill |
13
|
|
|
{ |
14
|
|
|
/** |
15
|
|
|
* Set autoFill option value. |
16
|
|
|
* Enable and configure the AutoFill extension for DataTables. |
17
|
|
|
* |
18
|
|
|
* @param bool|array $value |
19
|
|
|
* @return $this |
20
|
|
|
* @see https://datatables.net/reference/option/autoFill |
21
|
|
|
*/ |
22
|
|
|
public function autoFill($value = true) |
23
|
|
|
{ |
24
|
|
|
$this->attributes['autoFill'] = $value; |
|
|
|
|
25
|
|
|
|
26
|
|
|
return $this; |
27
|
|
|
} |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* Set autoFill alwaysAsk option value. |
31
|
|
|
* |
32
|
|
|
* @param bool $value |
33
|
|
|
* @return $this |
34
|
|
|
* @see https://datatables.net/reference/option/autoFill.alwaysAsk |
35
|
|
|
*/ |
36
|
|
|
public function autoFillAlwaysAsk(bool $value = true) |
37
|
|
|
{ |
38
|
|
|
$this->attributes['autoFill']['alwaysAsk'] = $value; |
39
|
|
|
|
40
|
|
|
return $this; |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* Set autoFill columns option value. |
45
|
|
|
* |
46
|
|
|
* @param mixed $value |
47
|
|
|
* @return $this |
48
|
|
|
* @see https://datatables.net/reference/option/autoFill.columns |
49
|
|
|
*/ |
50
|
|
|
public function autoFillColumns($value) |
51
|
|
|
{ |
52
|
|
|
$this->attributes['autoFill']['columns'] = $value; |
53
|
|
|
|
54
|
|
|
return $this; |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* Set autoFill editor option value. |
59
|
|
|
* |
60
|
|
|
* @param mixed $value |
61
|
|
|
* @return $this |
62
|
|
|
* @see https://datatables.net/reference/option/autoFill.editor |
63
|
|
|
*/ |
64
|
|
|
public function autoFillEditor($value) |
65
|
|
|
{ |
66
|
|
|
$this->attributes['autoFill']['editor'] = $value; |
67
|
|
|
|
68
|
|
|
return $this; |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* Set autoFill enable option value. |
73
|
|
|
* |
74
|
|
|
* @param bool $value |
75
|
|
|
* @return $this |
76
|
|
|
* @see https://datatables.net/reference/option/autoFill.enable |
77
|
|
|
*/ |
78
|
|
|
public function autoFillEnable(bool $value = true) |
79
|
|
|
{ |
80
|
|
|
$this->attributes['autoFill']['enable'] = $value; |
81
|
|
|
|
82
|
|
|
return $this; |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* Set autoFill focus option value. |
87
|
|
|
* |
88
|
|
|
* @param mixed $value |
89
|
|
|
* @return $this |
90
|
|
|
* @see https://datatables.net/reference/option/autoFill.focus |
91
|
|
|
*/ |
92
|
|
|
public function autoFillFocus($value = null) |
93
|
|
|
{ |
94
|
|
|
$this->attributes['autoFill']['focus'] = $value; |
95
|
|
|
|
96
|
|
|
return $this; |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
/** |
100
|
|
|
* Set autoFill horizontal option value. |
101
|
|
|
* |
102
|
|
|
* @param bool $value |
103
|
|
|
* @return $this |
104
|
|
|
* @see https://datatables.net/reference/option/autoFill.horizontal |
105
|
|
|
*/ |
106
|
|
|
public function autoFillHorizontal(bool $value = true) |
107
|
|
|
{ |
108
|
|
|
$this->attributes['autoFill']['horizontal'] = $value; |
109
|
|
|
|
110
|
|
|
return $this; |
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
/** |
114
|
|
|
* Set autoFill update option value. |
115
|
|
|
* |
116
|
|
|
* @param bool $value |
117
|
|
|
* @return $this |
118
|
|
|
* @see https://datatables.net/reference/option/autoFill.update |
119
|
|
|
*/ |
120
|
|
|
public function autoFillUpdate(bool $value = true) |
121
|
|
|
{ |
122
|
|
|
$this->attributes['autoFill']['update'] = $value; |
123
|
|
|
|
124
|
|
|
return $this; |
125
|
|
|
} |
126
|
|
|
|
127
|
|
|
/** |
128
|
|
|
* Set autoFill vertical option value. |
129
|
|
|
* |
130
|
|
|
* @param bool $value |
131
|
|
|
* @return $this |
132
|
|
|
* @see https://datatables.net/reference/option/autoFill.vertical |
133
|
|
|
*/ |
134
|
|
|
public function autoFillVertical(bool $value = true) |
135
|
|
|
{ |
136
|
|
|
$this->attributes['autoFill']['vertical'] = $value; |
137
|
|
|
|
138
|
|
|
return $this; |
139
|
|
|
} |
140
|
|
|
} |
141
|
|
|
|
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: