1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Yajra\DataTables\Html\Options\Plugins; |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* DataTables - KeyTable plugin option builder. |
7
|
|
|
* |
8
|
|
|
* @see https://datatables.net/extensions/keytable/ |
9
|
|
|
* @see https://datatables.net/reference/option/keys |
10
|
|
|
* @see https://datatables.net/reference/option/#keys |
11
|
|
|
*/ |
12
|
|
|
trait KeyTable |
13
|
|
|
{ |
14
|
|
|
/** |
15
|
|
|
* Set keys option value. |
16
|
|
|
* |
17
|
|
|
* @param bool|array $value |
18
|
|
|
* @return $this |
19
|
|
|
* @see https://datatables.net/reference/option/keys |
20
|
|
|
*/ |
21
|
|
|
public function keys($value = true) |
22
|
|
|
{ |
23
|
|
|
$this->attributes['keys'] = $value; |
|
|
|
|
24
|
|
|
|
25
|
|
|
return $this; |
26
|
|
|
} |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* Set keys blurable option value. |
30
|
|
|
* |
31
|
|
|
* @param bool $value |
32
|
|
|
* @return $this |
33
|
|
|
* @see https://datatables.net/reference/option/keys.blurable |
34
|
|
|
*/ |
35
|
|
|
public function keysBlurable(bool $value = true) |
36
|
|
|
{ |
37
|
|
|
$this->attributes['keys']['blurable'] = $value; |
38
|
|
|
|
39
|
|
|
return $this; |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* Set keys className option value. |
44
|
|
|
* |
45
|
|
|
* @param string $value |
46
|
|
|
* @return $this |
47
|
|
|
* @see https://datatables.net/reference/option/keys.className |
48
|
|
|
*/ |
49
|
|
|
public function keysClassName($value = 'focus') |
50
|
|
|
{ |
51
|
|
|
$this->attributes['keys']['className'] = $value; |
52
|
|
|
|
53
|
|
|
return $this; |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* Set keys clipboard option value. |
58
|
|
|
* |
59
|
|
|
* @param bool $value |
60
|
|
|
* @return $this |
61
|
|
|
* @see https://datatables.net/reference/option/keys.clipboard |
62
|
|
|
*/ |
63
|
|
|
public function keysClipboard(bool $value = true) |
64
|
|
|
{ |
65
|
|
|
$this->attributes['keys']['clipboard'] = $value; |
66
|
|
|
|
67
|
|
|
return $this; |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* Set keys clipboardOrthogonal option value. |
72
|
|
|
* |
73
|
|
|
* @param string $value |
74
|
|
|
* @return $this |
75
|
|
|
* @see https://datatables.net/reference/option/keys.clipboardOrthogonal |
76
|
|
|
*/ |
77
|
|
|
public function keysClipboardOrthogonal($value = 'display') |
78
|
|
|
{ |
79
|
|
|
$this->attributes['keys']['clipboardOrthogonal'] = $value; |
80
|
|
|
|
81
|
|
|
return $this; |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* Set keys columns option value. |
86
|
|
|
* |
87
|
|
|
* @param mixed $value |
88
|
|
|
* @return $this |
89
|
|
|
* @see https://datatables.net/reference/option/keys.columns |
90
|
|
|
*/ |
91
|
|
|
public function keysColumns($value) |
92
|
|
|
{ |
93
|
|
|
$this->attributes['keys']['columns'] = $value; |
94
|
|
|
|
95
|
|
|
return $this; |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
/** |
99
|
|
|
* Set keys editAutoSelect option value. |
100
|
|
|
* |
101
|
|
|
* @param bool $value |
102
|
|
|
* @return $this |
103
|
|
|
* @see https://datatables.net/reference/option/keys.editAutoSelect |
104
|
|
|
*/ |
105
|
|
|
public function keysEditAutoSelect(bool $value = true) |
106
|
|
|
{ |
107
|
|
|
$this->attributes['keys']['editAutoSelect'] = $value; |
108
|
|
|
|
109
|
|
|
return $this; |
110
|
|
|
} |
111
|
|
|
|
112
|
|
|
/** |
113
|
|
|
* Set keys editOnFocus option value. |
114
|
|
|
* |
115
|
|
|
* @param bool $value |
116
|
|
|
* @return $this |
117
|
|
|
* @see https://datatables.net/reference/option/keys.editOnFocus |
118
|
|
|
*/ |
119
|
|
|
public function keysEditOnFocus(bool $value = true) |
120
|
|
|
{ |
121
|
|
|
$this->attributes['keys']['editOnFocus'] = $value; |
122
|
|
|
|
123
|
|
|
return $this; |
124
|
|
|
} |
125
|
|
|
|
126
|
|
|
/** |
127
|
|
|
* Set keys editor option value. |
128
|
|
|
* |
129
|
|
|
* @param mixed $value |
130
|
|
|
* @return $this |
131
|
|
|
* @see https://datatables.net/reference/option/keys.editor |
132
|
|
|
*/ |
133
|
|
|
public function keysEditor($value) |
134
|
|
|
{ |
135
|
|
|
$this->attributes['keys']['editor'] = $value; |
136
|
|
|
|
137
|
|
|
return $this; |
138
|
|
|
} |
139
|
|
|
|
140
|
|
|
/** |
141
|
|
|
* Set keys editorKeys option value. |
142
|
|
|
* |
143
|
|
|
* @param mixed $value |
144
|
|
|
* @return $this |
145
|
|
|
* @see https://datatables.net/reference/option/keys.editorKeys |
146
|
|
|
*/ |
147
|
|
|
public function keysEditorKeys($value = 'navigation-only') |
148
|
|
|
{ |
149
|
|
|
$this->attributes['keys']['editorKeys'] = $value; |
150
|
|
|
|
151
|
|
|
return $this; |
152
|
|
|
} |
153
|
|
|
|
154
|
|
|
/** |
155
|
|
|
* Set keys focus option value. |
156
|
|
|
* |
157
|
|
|
* @param string $value |
158
|
|
|
* @return $this |
159
|
|
|
* @see https://datatables.net/reference/option/keys.focus |
160
|
|
|
*/ |
161
|
|
|
public function keysFocus($value) |
162
|
|
|
{ |
163
|
|
|
$this->attributes['keys']['focus'] = $value; |
164
|
|
|
|
165
|
|
|
return $this; |
166
|
|
|
} |
167
|
|
|
|
168
|
|
|
/** |
169
|
|
|
* Set keys keys option value. |
170
|
|
|
* |
171
|
|
|
* @param mixed $value |
172
|
|
|
* @return $this |
173
|
|
|
* @see https://datatables.net/reference/option/keys.keys |
174
|
|
|
*/ |
175
|
|
|
public function keysKeys($value) |
176
|
|
|
{ |
177
|
|
|
$this->attributes['keys']['keys'] = $value; |
178
|
|
|
|
179
|
|
|
return $this; |
180
|
|
|
} |
181
|
|
|
|
182
|
|
|
/** |
183
|
|
|
* Set keys tabIndex option value. |
184
|
|
|
* |
185
|
|
|
* @param mixed $value |
186
|
|
|
* @return $this |
187
|
|
|
* @see https://datatables.net/reference/option/keys.tabIndex |
188
|
|
|
*/ |
189
|
|
|
public function keysTabIndex($value) |
190
|
|
|
{ |
191
|
|
|
$this->attributes['keys']['tabIndex'] = $value; |
192
|
|
|
|
193
|
|
|
return $this; |
194
|
|
|
} |
195
|
|
|
} |
196
|
|
|
|
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: