Skip to content

Commit 83961fa

Browse files
committed
Add missing select field options as of Editor 1.5.4.
1 parent 7171b9f commit 83961fa

File tree

1 file changed

+74
-0
lines changed

1 file changed

+74
-0
lines changed

src/Html/Editor/Fields/Select.php

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,81 @@
22

33
namespace Yajra\DataTables\Html\Editor\Fields;
44

5+
/**
6+
* @see https://editor.datatables.net/reference/field/select
7+
*/
58
class Select extends Field
69
{
710
protected $type = 'select';
11+
12+
/**
13+
* Set field multiple value.
14+
*
15+
* @param bool $value
16+
* @return $this
17+
*/
18+
public function multiple(bool $value = true)
19+
{
20+
$this->attributes['multiple'] = $value;
21+
22+
return $this;
23+
}
24+
25+
/**
26+
* Set field optionsPair value.
27+
*
28+
* @param string|array $label
29+
* @param string $value
30+
* @return $this
31+
*/
32+
public function optionsPair($label = 'label', $value = 'value')
33+
{
34+
if (is_array($label)) {
35+
$this->attributes['optionsPair'] = $label;
36+
} else {
37+
$this->attributes['optionsPair']['label'] = $label;
38+
$this->attributes['optionsPair']['value'] = $value;
39+
}
40+
41+
return $this;
42+
}
43+
44+
/**
45+
* Set field placeholder value.
46+
*
47+
* @param string $value
48+
* @return $this
49+
*/
50+
public function placeholder($value)
51+
{
52+
$this->attributes['placeholder'] = $value;
53+
54+
return $this;
55+
}
56+
57+
/**
58+
* Set field placeholderDisabled value.
59+
*
60+
* @param bool $value
61+
* @return $this
62+
*/
63+
public function placeholderDisabled(bool $value)
64+
{
65+
$this->attributes['placeholderDisabled'] = $value;
66+
67+
return $this;
68+
}
69+
70+
/**
71+
* Set field placeholderValue value.
72+
*
73+
* @param string $value
74+
* @return $this
75+
*/
76+
public function placeholderValue($value)
77+
{
78+
$this->attributes['placeholderValue'] = $value;
79+
80+
return $this;
81+
}
882
}

0 commit comments

Comments
 (0)