@@ -39,11 +39,101 @@ public static function raw($options = [])
39
39
return new static ($ options );
40
40
}
41
41
42
+ /**
43
+ * Set attr option value.
44
+ *
45
+ * @param array $value
46
+ * @return $this
47
+ * @see https://datatables.net/reference/option/buttons.buttons.attr
48
+ */
49
+ public function attr (array $ value )
50
+ {
51
+ $ this ->attributes ['attr ' ] = $ value ;
52
+
53
+ return $ this ;
54
+ }
55
+
56
+ /**
57
+ * Set available option value.
58
+ *
59
+ * @param string $value
60
+ * @return $this
61
+ * @see https://datatables.net/reference/option/buttons.buttons.available
62
+ */
63
+ public function available ($ value )
64
+ {
65
+ if ($ this ->isFunction ($ value )) {
66
+ $ this ->attributes ['available ' ] = $ value ;
67
+ } else {
68
+ $ this ->attributes ['available ' ] = "function(dt, config) { $ value } " ;
69
+ }
70
+
71
+ return $ this ;
72
+ }
73
+
74
+ /**
75
+ * Check if a given value is a function.
76
+ *
77
+ * @param string $value
78
+ * @return bool
79
+ */
80
+ protected function isFunction ($ value )
81
+ {
82
+ return substr ($ value , 0 , 8 ) == 'function ' ;
83
+ }
84
+
85
+ /**
86
+ * Set enabled option value.
87
+ *
88
+ * @param bool $value
89
+ * @return $this
90
+ * @see https://datatables.net/reference/option/buttons.buttons.enabled
91
+ */
92
+ public function enabled ($ value = true )
93
+ {
94
+ $ this ->attributes ['enabled ' ] = $ value ;
95
+
96
+ return $ this ;
97
+ }
98
+
99
+ /**
100
+ * Set init option value.
101
+ *
102
+ * @param string $value
103
+ * @return $this
104
+ * @see https://datatables.net/reference/option/buttons.buttons.init
105
+ */
106
+ public function init ($ value )
107
+ {
108
+ if ($ this ->isFunction ($ value )) {
109
+ $ this ->attributes ['init ' ] = $ value ;
110
+ } else {
111
+ $ this ->attributes ['init ' ] = "function(dt, node, config) { $ value } " ;
112
+ }
113
+
114
+ return $ this ;
115
+ }
116
+
117
+ /**
118
+ * Set key option value.
119
+ *
120
+ * @param string|array $value
121
+ * @return $this
122
+ * @see https://datatables.net/reference/option/buttons.buttons.key
123
+ */
124
+ public function key ($ value )
125
+ {
126
+ $ this ->attributes ['key ' ] = $ value ;
127
+
128
+ return $ this ;
129
+ }
130
+
42
131
/**
43
132
* Set extend option value.
44
133
*
45
134
* @param string $value
46
135
* @return $this
136
+ * @see https://datatables.net/reference/option/buttons.buttons.extend
47
137
*/
48
138
public function extend ($ value )
49
139
{
@@ -57,6 +147,7 @@ public function extend($value)
57
147
*
58
148
* @param string $value
59
149
* @return $this
150
+ * @see https://editor.datatables.net/reference/button
60
151
*/
61
152
public function editor ($ value )
62
153
{
@@ -66,8 +157,11 @@ public function editor($value)
66
157
}
67
158
68
159
/**
160
+ * Set buttons option value.
161
+ *
69
162
* @param array $buttons
70
163
* @return $this
164
+ * @see https://datatables.net/reference/option/buttons.buttons
71
165
*/
72
166
public function buttons (array $ buttons )
73
167
{
@@ -134,6 +228,7 @@ public function formTitle($title)
134
228
*
135
229
* @param string $value
136
230
* @return $this
231
+ * @see https://datatables.net/reference/option/buttons.buttons.className
137
232
*/
138
233
public function className ($ value )
139
234
{
@@ -142,6 +237,24 @@ public function className($value)
142
237
return $ this ;
143
238
}
144
239
240
+ /**
241
+ * Set destroy option value.
242
+ *
243
+ * @param string $value
244
+ * @return $this
245
+ * @see https://datatables.net/reference/option/buttons.buttons.destroy
246
+ */
247
+ public function destroy ($ value )
248
+ {
249
+ if ($ this ->isFunction ($ value )) {
250
+ $ this ->attributes ['destroy ' ] = $ value ;
251
+ } else {
252
+ $ this ->attributes ['destroy ' ] = "function(dt, node, config) { $ value } " ;
253
+ }
254
+
255
+ return $ this ;
256
+ }
257
+
145
258
/**
146
259
* Set customize option value.
147
260
*
@@ -178,6 +291,7 @@ public function addClass($class)
178
291
*
179
292
* @param string $value
180
293
* @return $this
294
+ * @see https://datatables.net/reference/option/buttons.buttons.text
181
295
*/
182
296
public function text ($ value )
183
297
{
@@ -186,11 +300,26 @@ public function text($value)
186
300
return $ this ;
187
301
}
188
302
303
+ /**
304
+ * Set titleAttr option value.
305
+ *
306
+ * @param string $value
307
+ * @return $this
308
+ * @see https://datatables.net/reference/option/buttons.buttons.titleAttr
309
+ */
310
+ public function titleAttr ($ value )
311
+ {
312
+ $ this ->attributes ['titleAttr ' ] = $ value ;
313
+
314
+ return $ this ;
315
+ }
316
+
189
317
/**
190
318
* Set name option value.
191
319
*
192
320
* @param string $value
193
321
* @return $this
322
+ * @see https://datatables.net/reference/option/buttons.buttons.name
194
323
*/
195
324
public function name ($ value )
196
325
{
@@ -199,6 +328,34 @@ public function name($value)
199
328
return $ this ;
200
329
}
201
330
331
+ /**
332
+ * Set namespace option value.
333
+ *
334
+ * @param string $value
335
+ * @return $this
336
+ * @see https://datatables.net/reference/option/buttons.buttons.namespace
337
+ */
338
+ public function namespace ($ value )
339
+ {
340
+ $ this ->attributes ['namespace ' ] = $ value ;
341
+
342
+ return $ this ;
343
+ }
344
+
345
+ /**
346
+ * Set tag option value.
347
+ *
348
+ * @param string $value
349
+ * @return $this
350
+ * @see https://datatables.net/reference/option/buttons.buttons.tag
351
+ */
352
+ public function tag ($ value )
353
+ {
354
+ $ this ->attributes ['tag ' ] = $ value ;
355
+
356
+ return $ this ;
357
+ }
358
+
202
359
/**
203
360
* Set columns option value.
204
361
*
0 commit comments