-
Notifications
You must be signed in to change notification settings - Fork 554
/
MultiSelect.php
103 lines (77 loc) · 2.26 KB
/
MultiSelect.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<?php
namespace A17\Twill\Services\Forms\Fields;
use A17\Twill\Services\Forms\Fields\Traits\HasBorder;
use A17\Twill\Services\Forms\Fields\Traits\HasMax;
use A17\Twill\Services\Forms\Fields\Traits\HasMin;
use A17\Twill\Services\Forms\Fields\Traits\HasOptions;
use A17\Twill\Services\Forms\Fields\Traits\HasPlaceholder;
use A17\Twill\Services\Forms\Fields\Traits\Inlineable;
use A17\Twill\Services\Forms\Fields\Traits\IsTranslatable;
use A17\Twill\Services\Forms\Fields\Traits\Unpackable;
class MultiSelect extends BaseFormField
{
use IsTranslatable;
use HasOptions;
use HasMax;
use HasMin;
use Inlineable;
use Unpackable;
use HasBorder;
use HasPlaceholder;
protected bool $searchable = false;
protected bool $pushTags = false;
protected bool $taggable = false;
protected bool $addNew = false;
protected ?string $moduleName = null;
protected ?string $storeUrl = null;
protected ?string $endpoint = null;
public static function make(): static
{
return new self(
component: \A17\Twill\View\Components\Fields\MultiSelect::class,
mandatoryProperties: ['name', 'label']
);
}
/**
* If the options should be searchable.
*/
public function searchable(bool $searchable = true): static
{
$this->searchable = $searchable;
return $this;
}
public function canAddNew(bool $canAddNew = true): static
{
$this->addNew = $canAddNew;
return $this;
}
public function moduleName(string $moduleName): static
{
$this->moduleName = $moduleName;
return $this;
}
public function storeUrl(string $storeUrl): static
{
$this->storeUrl = $storeUrl;
return $this;
}
public function taggable(bool $taggable = true): static
{
$this->taggable = $taggable;
return $this;
}
public function pushTags(bool $pushTags = true): static
{
$this->pushTags = $pushTags;
return $this;
}
public function endpoint(string $endpoint): static
{
$this->endpoint = $endpoint;
return $this;
}
protected function getAdditionalConstructorArguments(): array
{
return ['options' => $this->getOptions()];
}
}