Backend\Classes\FormField

Overview

FormField definition is a translation of the form field configuration

Extends
Implements
  • Illuminate\Contracts\Support\Arrayable
  • ArrayAccess
  • Illuminate\Contracts\Support\Jsonable
  • JsonSerializable

Public Properties

There are no public properties in the class.

Show inherited public properties

Inherited Public Properties

Protected Properties

There are no protected properties in the class.

Show inherited protected properties

Inherited Protected Properties


Public Methods

public __construct()

public __construct($config = [], $label = null): void

__construct using old and new interface

public getAttributes()

public getAttributes(string $position = 'field', $htmlBuild = true): array 

getAttributes returns the attributes for this field at a given position.

public getDefaultFromData()

public getDefaultFromData(mixed $data): mixed 

getDefaultFromData returns the default value for this field, the supplied data is used to source data when defaultFrom is specified.

public getDisplayValue()

public getDisplayValue($value): void

getDisplayValue checks to see if display values (model attributes) should be translated, and also escapes the value

public getId()

public getId(string $suffix = null): string 

getId returns a value suitable for the field id property.

public getName()

public getName(string $arrayName = null): string 

getName returns a value suitable for the field name property.

public getOptionsFromModel()

public getOptionsFromModel($model, $fieldOptions, $data): void

getOptionsFromModel looks at the model for defined options.

public getTranslatableMessage()

public getTranslatableMessage(): string 

public getValueFromData()

public getValueFromData(mixed $data, mixed $default = null): mixed 

getValueFromData returns this fields value from a supplied data set, which can be an array or a model or another generic collection.

public hasAttribute()

public hasAttribute(string $name, string $position = 'field'): bool 

hasAttribute checks if the field has the supplied [unfiltered] attribute.

public isSelected()

public isSelected(string $value = true): bool 

isSelected determines if the provided value matches this field's value.

public nearestModelAttribute()

public nearestModelAttribute($model, $attribute = null): void

nearestModelAttribute returns the nearest model and attribute name of a nested attribute, which is useful for checking if an attribute is jsonable or a relation.

public resolveModelAttribute()

public resolveModelAttribute(string $attribute, $attribute = null): array 

resolveModelAttribute returns the final model and attribute name of a nested attribute. Eg:

[$model, $attribute] = $this->resolveAttribute('person[phone]');

Show inherited public methods

Inherited Public Methods

Protected Methods

protected filterAttributes()

protected filterAttributes(
    array $attributes,
    string $position = 'field'
): array 

filterAttributes adds any circumstantial attributes to the field based on other settings, such as the 'disabled' option.

protected filterPresetAttributes()

protected filterPresetAttributes(
    array $attributes,
    string $position = 'field'
): array 

filterPresetAttributes adds attributes used specifically by the Input Preset API

protected filterTriggerAttributes()

protected filterTriggerAttributes(
    array $attributes,
    string $position = 'field'
): array 

filterTriggerAttributes adds attributes used specifically by the Trigger API

protected getFieldNameFromData()

protected getFieldNameFromData(
    string $fieldName,
    mixed $data,
    mixed $default = null
): mixed 

getFieldNameFromData is an internal method to extract the value of a field name from a data set.

protected getOptionsFromModelAsDefault()

protected getOptionsFromModelAsDefault($model, $data): void

getOptionsFromModelAsDefault refers to the model method or any of its behaviors

protected getOptionsFromModelAsString()

protected getOptionsFromModelAsString($model, $methodName, $data): void

getOptionsFromModelAsString where options are an explicit method reference

protected initDefaultValues()

protected initDefaultValues(): void

initDefaultValues for this field

protected objectMethodExists()

protected objectMethodExists(object $object, string $method): boolean 

objectMethodExists is an internal helper for method existence checks.

protected resolveModelAttributeInternal()

protected resolveModelAttributeInternal(
    $model,
    $attribute = null,
    $options = []
): void

resolveModelAttributeInternal is an internal method resolver for resolveModelAttribute

Show inherited protected methods

Inherited Protected Methods