Listbox
class Listbox extends MultipleSelect
Class ListBox.
Traits
Constants
FILE_DELETE_FLAG |
|
FILE_SORT_FLAG |
|
Properties
array|Closure | $creationRules | The validation rules for creation. |
from Field |
array|Closure | $updateRules | The validation rules for updates. |
from Field |
bool | $isJsonType | from Field | |
protected array|string | $id | Element id. |
from Field |
protected mixed | $value | Element value. |
from Field |
protected mixed | $data | Data of all original columns of value. |
from Field |
protected mixed | $original | Field original value. |
from Field |
protected mixed | $default | Field default value. |
from Field |
protected string | $label | Element label. |
from Field |
protected string|array | $column | Column name. |
from Field |
protected string | $elementName | Form element name. |
from Field |
protected array | $elementClass | Form element classes. |
from Field |
protected array | $variables | Variables of elements. |
from Field |
protected array | $options | Options for specify elements. |
from Field |
protected array | $checked | Checked for specify elements. |
from Field |
protected array|Closure | $rules | Validation rules. |
from Field |
protected Closure | $validator | from Field | |
protected array | $validationMessages | Validation messages. |
from Field |
protected array | $attributes | Element attributes. |
from Field |
protected Form | $form | Parent form. |
from Field |
protected string | $view | View for field to render. |
from Field |
protected array | $help | Help block. |
from Field |
protected mixed | $errorKey | Key for errors. |
from Field |
protected | $placeholder | from Select | |
protected bool | $showHelp | from Field | |
protected array | $width | Width for label and field. |
from Field |
protected bool | $horizontal | If the form horizontal layout. |
from Field |
protected Closure | $customFormat | column data format. |
from Field |
protected bool | $display | from Field | |
protected array | $labelClass | from Field | |
protected array | $groupClass | from Field | |
protected Closure | $callback | from Field | |
protected array | $groups | from Select | |
protected array | $config | from Select | |
protected string | $otherKey | Other key for many-to-many relation. |
from MultipleSelect |
protected | $settings |
Methods
Set the validation rules for the field.
Set the update validation rules for the field.
Set the creation validation rules for the field.
Set validation messages for column.
Set help block for current field.
Add html attributes to elements.
reset field className.
No description
Add required
attribute to current field if has required rule,
except file and image fields.
If has required
rule, add required attribute to this field.
Load options from current selected resource(s).
No description
No description
Details
in
Field at line 229
__construct($column = '', array $arguments = [])
Field constructor.
in
Field at line 245
$this
setElementName(string $name)
Set form element name.
in
MultipleSelect at line 21
void
fill(array $data)
No description
in
MultipleSelect at line 55
void
setOriginal(array $data)
No description
in
Field at line 330
$this
setWidth(int $field = 8, int $label = 2)
Set width for field and label.
in
Select at line 35
$this
options(array $options = [])
Set options.
in
Field at line 365
$this
checked(array $checked = [])
Set the field option checked.
in
Field at line 384
$this
rules(array $rules = [], array $messages = [])
Set the validation rules for the field.
in
Field at line 401
$this
updateRules(array|callable $rules = [], array $messages = [])
Set the update validation rules for the field.
in
Field at line 418
$this
creationRules(array|callable $rules = [], array $messages = [])
Set the creation validation rules for the field.
in
Field at line 432
array|mixed
getValidationMessages()
Get validation messages for the field.
in
Field at line 455
$this
setValidationMessages(string $key, array $messages)
Set validation messages for column.
in
Field at line 469
$this
validator(callable $validator)
Set field validator.
in
Field at line 481
string
getErrorKey()
Get key for error message.
in
Field at line 493
$this
setErrorKey(string $key)
Set key for error message.
in
Field at line 507
mixed
value(null $value = null)
Set or get value of the field.
in
Field at line 523
$this
data(array $data = null)
Set or get data.
in
Field at line 541
$this
default($default)
Set default value for field.
in
Field at line 553
mixed
getDefault()
Get default value.
in
Field at line 570
$this
help(string $text = '', string $icon = 'fa-info-circle')
Set help block for current field.
in
Field at line 582
string|array
column()
Get column of the field.
in
Field at line 592
string
label()
Get label of the field.
in
Field at line 602
mixed
original()
Get original value of the field.
in
Field at line 614
bool|Validator|mixed
getValidator(array $input)
Get validator for this field.
in
Field at line 655
$this
attribute(array|string $attribute, mixed $value = null)
Add html attributes to elements.
in
Field at line 675
$this
style(string $attr, string $value)
Set Field style.
in
Field at line 687
$this
width(string $width)
Set Field width.
in
Field at line 697
$this
autofocus()
Set the field automatically get focus.
in
Field at line 707
$this
readonly()
Set the field as readonly mode.
in
Field at line 717
$this
disable()
Set field as disabled.
in
Field at line 729
$this
placeholder(string $placeholder = '')
Set field placeholder.
in
Field at line 741
string
getPlaceholder()
Get placeholder.
in
MultipleSelect at line 86
mixed
prepare($value)
Prepare for a field value before update or insert.
in
Field at line 763
$this
disableHorizontal()
No description
in
Field at line 773
array
getViewElementClasses()
No description
in
Field at line 795
array
getElementClass()
Get element class.
in
Field at line 807
$this
setElementClass(string|array $class)
Set form element class.
in
Field at line 821
$this
addElementClass($class)
Add the element class.
in
Field at line 837
$this
removeElementClass($class)
Remove element class.
in
Field at line 862
$this
resetElementClassName(string $className, string $resetClassName)
reset field className.
in
Field at line 874
string
getLabelClass()
No description
in
Field at line 896
array
variables()
Get the view variables of this field.
in
Field at line 921
string
getView()
Get view of this field.
in
Field at line 939
string
setView(string $view)
Set view of current field.
in
Field at line 946
string
getType()
No description
in
Field at line 959
$this
setDisplay(bool $display)
To set this field should render or not.
at line 44
Factory|View|string
render()
No description
in
Field at line 1000
string
__toString()
No description
in
Field at line 1010
string
getRules()
Get field validation rules.
in
Field at line 1056
array|mixed|string
formatName(string $column)
Format the name of the field.
in
Field at line 1090
array
skeleton()
No description
in
Field at line 1102
protected mixed
formatColumn(string $column = '')
Format the field column name.
in
Field at line 1120
protected string|array
formatId(string|array $column)
Format the field element id.
in
Field at line 1132
protected string
formatLabel(array $arguments = [])
Format the label value.
in
Field at line 1144
protected
formatValue()
Format value by passing custom formater.
in
Field at line 1157
protected
addRequiredAttribute(array $rules)
Add required
attribute to current field if has required rule,
except file and image fields.
in
Field at line 1167
protected
addRequiredAttributeFromRules()
If has required
rule, add required attribute to this field.
in
Field at line 1188
protected array
formatRules(array|string $rules)
Format validation rules.
in
Field at line 1203
protected array|Closure
mergeRules(string|array|Closure $input, string|array $original)
No description
in
Field at line 1226
protected void
removeRule(string $rule)
Remove a specific rule by keyword.
in
Field at line 1249
protected array
sanitizeInput(array $input, string $column)
Sanitize input data.
in
Field at line 1264
protected string
formatAttributes()
Format the field attributes.
in
Field at line 1280
protected mixed
getElementClassString()
Get element class string.
in
Field at line 1303
protected string|array
getElementClassSelector()
Get element class selector.
in
Field at line 1327
protected string
getGroupClass(bool $default = false)
Get element class.
in
Field at line 1358
protected Field
addVariables(array $variables = [])
Add variables to field view.
in
Field at line 1373
protected bool
shouldRender()
If this field should render.
in
Select at line 98
$this
groups(array $groups)
Set option groups.
eg: $group = [ [ 'label' => 'xxxx', 'options' => [ 1 => 'foo', 2 => 'bar', ... ], ... ]
in
Select at line 114
$this
model(string $model, string $idField = 'id', string $textField = 'name')
Load options from current selected resource(s).
in
Select at line 158
$this
config(string $key, mixed $val)
Set config for select2.
all configurations see https://select2.org/configuration/options-api
in
MultipleSelect at line 100
protected string
getOtherKey()
Get other key for this many-to-many relation.
at line 17
settings(array $settings)
No description
at line 31
Listbox
height(int $height = 200)
Set listbox height.
at line 39
protected
loadRemoteOptions($url, $parameters = [], $options = [])
No description