Field
class Field implements Renderable
Class Field.
Traits
Constants
FILE_DELETE_FLAG |
|
FILE_SORT_FLAG |
|
Properties
array|Closure | $creationRules | The validation rules for creation. |
|
array|Closure | $updateRules | The validation rules for updates. |
|
bool | $isJsonType | ||
protected array|string | $id | Element id. |
|
protected mixed | $value | Element value. |
|
protected mixed | $data | Data of all original columns of value. |
|
protected mixed | $original | Field original value. |
|
protected mixed | $default | Field default value. |
|
protected string | $label | Element label. |
|
protected string|array | $column | Column name. |
|
protected string | $elementName | Form element name. |
|
protected array | $elementClass | Form element classes. |
|
protected array | $variables | Variables of elements. |
|
protected array | $options | Options for specify elements. |
|
protected array | $checked | Checked for specify elements. |
|
protected array|Closure | $rules | Validation rules. |
|
protected Closure | $validator | ||
protected array | $validationMessages | Validation messages. |
|
protected array | $attributes | Element attributes. |
|
protected Form | $form | Parent form. |
|
protected string | $view | View for field to render. |
|
protected array | $help | Help block. |
|
protected mixed | $errorKey | Key for errors. |
|
protected string|array | $placeholder | Placeholder for this field. |
|
protected bool | $showHelp | ||
protected array | $width | Width for label and field. |
|
protected bool | $horizontal | If the form horizontal layout. |
|
protected Closure | $customFormat | column data format. |
|
protected bool | $display | ||
protected array | $labelClass | ||
protected array | $groupClass | ||
protected Closure | $callback |
Methods
Field constructor.
Set form element name.
Fill data to the field.
Set original value to the field.
Set width for field and label.
Set the field options.
Set the field option checked.
Set the validation rules for the field.
Set the update validation rules for the field.
Set the creation validation rules for the field.
Get validation messages for the field.
Set validation messages for column.
Set field validator.
Get key for error message.
Set key for error message.
Set or get value of the field.
Set or get data.
Set default value for field.
Get default value.
Set help block for current field.
Get column of the field.
Get label of the field.
Get original value of the field.
Get validator for this field.
Add html attributes to elements.
Set Field style.
Set Field width.
Set the field automatically get focus.
Set the field as readonly mode.
Set field as disabled.
Set field placeholder.
Get placeholder.
Prepare for a field value before update or insert.
No description
No description
Get element class.
Set form element class.
Add the element class.
Remove element class.
reset field className.
No description
No description
Get the view variables of this field.
Get view of this field.
Set view of current field.
No description
To set this field should render or not.
Render this filed.
No description
Get field validation rules.
Format the name of the field.
No description
Format the field column name.
Format the field element id.
Format the label value.
Format value by passing custom formater.
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.
Format validation rules.
Remove a specific rule by keyword.
Sanitize input data.
Format the field attributes.
Get element class string.
Get element class selector.
Get element class.
Set form group class.
Add variables to field view.
If this field should render.
Details
at line 224
__construct($column = '', array $arguments = [])
Field constructor.
at line 240
$this
setElementName(string $name)
Set form element name.
at line 254
void
fill(array $data)
Fill data to the field.
at line 278
$this
customFormat(Closure $call)
custom format form column data when edit.
at line 292
void
setOriginal(array $data)
Set original value to the field.
at line 310
$this
setForm(Form $form = null)
No description
at line 325
$this
setWidth(int $field = 8, int $label = 2)
Set width for field and label.
at line 342
$this
options(array $options = [])
Set the field options.
at line 360
$this
checked(array $checked = [])
Set the field option checked.
at line 379
$this
rules(array $rules = [], array $messages = [])
Set the validation rules for the field.
at line 396
$this
updateRules(array|callable $rules = [], array $messages = [])
Set the update validation rules for the field.
at line 413
$this
creationRules(array|callable $rules = [], array $messages = [])
Set the creation validation rules for the field.
at line 427
array|mixed
getValidationMessages()
Get validation messages for the field.
at line 450
$this
setValidationMessages(string $key, array $messages)
Set validation messages for column.
at line 464
$this
validator(callable $validator)
Set field validator.
at line 476
string
getErrorKey()
Get key for error message.
at line 488
$this
setErrorKey(string $key)
Set key for error message.
at line 502
mixed
value(null $value = null)
Set or get value of the field.
at line 518
$this
data(array $data = null)
Set or get data.
at line 536
$this
default($default)
Set default value for field.
at line 548
mixed
getDefault()
Get default value.
at line 565
$this
help(string $text = '', string $icon = 'fa-info-circle')
Set help block for current field.
at line 577
string|array
column()
Get column of the field.
at line 587
string
label()
Get label of the field.
at line 597
mixed
original()
Get original value of the field.
at line 609
bool|Validator|mixed
getValidator(array $input)
Get validator for this field.
at line 650
$this
attribute(array|string $attribute, mixed $value = null)
Add html attributes to elements.
at line 670
$this
style(string $attr, string $value)
Set Field style.
at line 682
$this
width(string $width)
Set Field width.
at line 692
$this
autofocus()
Set the field automatically get focus.
at line 702
$this
readonly()
Set the field as readonly mode.
at line 712
$this
disable()
Set field as disabled.
at line 724
$this
placeholder(string $placeholder = '')
Set field placeholder.
at line 736
string
getPlaceholder()
Get placeholder.
at line 750
mixed
prepare($value)
Prepare for a field value before update or insert.
at line 758
$this
disableHorizontal()
No description
at line 768
array
getViewElementClasses()
No description
at line 790
array
getElementClass()
Get element class.
at line 802
$this
setElementClass(string|array $class)
Set form element class.
at line 816
$this
addElementClass($class)
Add the element class.
at line 832
$this
removeElementClass($class)
Remove element class.
at line 857
$this
resetElementClassName(string $className, string $resetClassName)
reset field className.
at line 869
string
getLabelClass()
No description
at line 879
Field
setLabelClass(array $labelClass)
No description
at line 891
array
variables()
Get the view variables of this field.
at line 916
string
getView()
Get view of this field.
at line 934
string
setView(string $view)
Set view of current field.
at line 941
string
getType()
No description
at line 954
$this
setDisplay(bool $display)
To set this field should render or not.
at line 978
Factory|View|string
render()
Render this filed.
at line 995
string
__toString()
No description
at line 1005
string
getRules()
Get field validation rules.
at line 1051
array|mixed|string
formatName(string $column)
Format the name of the field.
at line 1085
array
skeleton()
No description
at line 1097
protected mixed
formatColumn(string $column = '')
Format the field column name.
at line 1115
protected string|array
formatId(string|array $column)
Format the field element id.
at line 1127
protected string
formatLabel(array $arguments = [])
Format the label value.
at line 1139
protected
formatValue()
Format value by passing custom formater.
at line 1152
protected
addRequiredAttribute(array $rules)
Add required
attribute to current field if has required rule,
except file and image fields.
at line 1162
protected
addRequiredAttributeFromRules()
If has required
rule, add required attribute to this field.
at line 1183
protected array
formatRules(array|string $rules)
Format validation rules.
at line 1198
protected array|Closure
mergeRules(string|array|Closure $input, string|array $original)
No description
at line 1221
protected void
removeRule(string $rule)
Remove a specific rule by keyword.
at line 1244
protected array
sanitizeInput(array $input, string $column)
Sanitize input data.
at line 1259
protected string
formatAttributes()
Format the field attributes.
at line 1275
protected mixed
getElementClassString()
Get element class string.
at line 1298
protected string|array
getElementClassSelector()
Get element class selector.
at line 1322
protected string
getGroupClass(bool $default = false)
Get element class.
at line 1334
Field
setGroupClass(string|array $class)
Set form group class.
at line 1353
protected Field
addVariables(array $variables = [])
Add variables to field view.
at line 1368
protected bool
shouldRender()
If this field should render.