Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8053d44

Browse files
committed
Add missing setters as per docs.
https://datatables.net/reference/option/#buttons
1 parent6c902a8 commit8053d44

File tree

1 file changed

+157
-0
lines changed

1 file changed

+157
-0
lines changed

‎src/Html/Button.php‎

Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,101 @@ public static function raw($options = [])
3939
returnnewstatic($options);
4040
}
4141

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+
publicfunctionattr(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+
publicfunctionavailable($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+
protectedfunctionisFunction($value)
81+
{
82+
returnsubstr($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+
publicfunctionenabled($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+
publicfunctioninit($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+
publicfunctionkey($value)
125+
{
126+
$this->attributes['key'] =$value;
127+
128+
return$this;
129+
}
130+
42131
/**
43132
* Set extend option value.
44133
*
45134
* @param string $value
46135
* @return $this
136+
* @see https://datatables.net/reference/option/buttons.buttons.extend
47137
*/
48138
publicfunctionextend($value)
49139
{
@@ -57,6 +147,7 @@ public function extend($value)
57147
*
58148
* @param string $value
59149
* @return $this
150+
* @see https://editor.datatables.net/reference/button
60151
*/
61152
publicfunctioneditor($value)
62153
{
@@ -66,8 +157,11 @@ public function editor($value)
66157
}
67158

68159
/**
160+
* Set buttons option value.
161+
*
69162
* @param array $buttons
70163
* @return $this
164+
* @see https://datatables.net/reference/option/buttons.buttons
71165
*/
72166
publicfunctionbuttons(array$buttons)
73167
{
@@ -134,6 +228,7 @@ public function formTitle($title)
134228
*
135229
* @param string $value
136230
* @return $this
231+
* @see https://datatables.net/reference/option/buttons.buttons.className
137232
*/
138233
publicfunctionclassName($value)
139234
{
@@ -142,6 +237,24 @@ public function className($value)
142237
return$this;
143238
}
144239

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+
publicfunctiondestroy($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+
145258
/**
146259
* Set customize option value.
147260
*
@@ -178,6 +291,7 @@ public function addClass($class)
178291
*
179292
* @param string $value
180293
* @return $this
294+
* @see https://datatables.net/reference/option/buttons.buttons.text
181295
*/
182296
publicfunctiontext($value)
183297
{
@@ -186,11 +300,26 @@ public function text($value)
186300
return$this;
187301
}
188302

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+
publicfunctiontitleAttr($value)
311+
{
312+
$this->attributes['titleAttr'] =$value;
313+
314+
return$this;
315+
}
316+
189317
/**
190318
* Set name option value.
191319
*
192320
* @param string $value
193321
* @return $this
322+
* @see https://datatables.net/reference/option/buttons.buttons.name
194323
*/
195324
publicfunctionname($value)
196325
{
@@ -199,6 +328,34 @@ public function name($value)
199328
return$this;
200329
}
201330

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+
publicfunctionnamespace($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+
publicfunctiontag($value)
353+
{
354+
$this->attributes['tag'] =$value;
355+
356+
return$this;
357+
}
358+
202359
/**
203360
* Set columns option value.
204361
*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp