-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSelect2.php
More file actions
118 lines (113 loc) · 3.45 KB
/
Select2.php
File metadata and controls
118 lines (113 loc) · 3.45 KB
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<?php
namespace Javaabu\Forms\Views\Components;
class Select2 extends Select
{
public bool $allowClear;
public bool $isFirst;
public bool $hideSearch;
public string $child;
public string $ajaxChild;
public string $ajaxUrl;
public string $selectedUrl;
public string $filterField;
public string $filterBy;
public string $fallback;
public string $parentModal;
/**
* Create a new component instance.
*
* @return void
*/
public function __construct(
string $name,
string $label = '',
string $placeholder = '',
$options = [],
$model = null,
$default = null,
bool $multiple = false,
bool $relation = false,
bool $showErrors = true,
bool $showLabel = true,
bool $showPlaceholder = false,
bool $required = false,
bool $isAjax = false,
bool $isFirst = false,
bool $tags = false,
bool $hideSearch = false,
bool $allowClear = true,
public bool $isIconSelect = false,
string $child = '',
string $ajaxChild = '',
string $ajaxUrl = '',
string $selectedUrl = '',
string $nameField = '',
string $idField = '',
string $filterField = '',
string $filterBy = '',
string $fallback = '',
string $parentModal = '',
public string $iconPrefix = '',
bool $disabled = false,
bool $excludeSyncField = false,
string $syncFieldName = '',
bool $inline = false,
bool $floating = false,
string $inlineLabelClass = '',
string $inlineInputClass = '',
string $formGroupClass = '',
bool $showJsErrors = false,
string $framework = ''
) {
if ($allowClear && empty($placeholder)) {
$placeholder = $this->getNothingSelectedText();
}
parent::__construct(
$name,
label: $label,
placeholder: $placeholder,
options: $options,
model: $model,
default: $default,
multiple: $multiple,
relation: $relation,
showErrors: $showErrors,
showLabel: $showLabel,
showPlaceholder: $showPlaceholder,
required: $required,
inline: $inline,
floating: $floating,
isSelect2: true,
isAjax: $isAjax,
disabled: $disabled,
excludeSyncField: $excludeSyncField,
syncFieldName: $syncFieldName,
nameField: $nameField,
idField: $idField,
tags: $tags,
inlineLabelClass: $inlineLabelClass,
inlineInputClass: $inlineInputClass,
formGroupClass: $formGroupClass,
showJsErrors: $showJsErrors,
framework: $framework
);
$this->isFirst = $isFirst;
$this->child = $child;
$this->ajaxChild = $ajaxChild;
$this->ajaxUrl = $ajaxUrl;
$this->selectedUrl = $selectedUrl;
$this->filterField = $filterField;
$this->filterBy = $filterBy;
$this->hideSearch = $hideSearch;
$this->allowClear = $allowClear;
$this->fallback = $fallback;
$this->parentModal = $parentModal;
}
/**
* Get the default nothing selected text
*/
public function getNothingSelectedText(): string
{
return trans('forms::strings.nothing_selected');
}
}