Skip to content

Commit 3b91620

Browse files
committed
Added default value for id prop.
1 parent e4a2035 commit 3b91620

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/SimpleSelect.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ class SimpleSelect extends Component
2929
* @return void
3030
*/
3131
public function __construct(
32-
array $options,
33-
string $id,
34-
string $name,
32+
array $options = [],
33+
string $id = null,
34+
string $name = null,
3535
$valueField = 'value',
3636
$textField = 'text' ,
3737
$value = null ,
@@ -57,6 +57,13 @@ public function __construct(
5757
$this->maxSelection = $maxSelection;
5858
$this->searchable = $searchable;
5959
$this->clearable = $clearable;
60+
61+
if (!$this->id) {
62+
$this->id = 'simple-select-' . uniqid();
63+
}
64+
if (!$this->name) {
65+
$this->name = $this->id;
66+
}
6067
}
6168

6269
/**

0 commit comments

Comments
 (0)