FieldsAlgorithms
extends FieldsSet
in package
Class constructs forms
Table of Contents
- $typeMap : array<string|int, mixed>
- Supported types
- $entityName : string
- Entity name
- $fieldObjects : array<string|int, mixed>
- List of control objects
- $fields : mixed
- List of fields
- $sessionId : string
- Session Id
- __construct() : mixed
- Constructor
- fetchCustomField() : array<string|int, mixed>
- Method fetches returns custom fields for saving
- fetchField() : void
- Method fetches submitted field
- getCompiledField() : string
- Method compiles field DOM
- getEntityName() : string
- Method returns entity name
- getFields() : array<string|int, mixed>
- Getting fields
- getFieldsNames() : array<string|int, string>
- Method returns array of fields names
- getFieldType() : string
- Method returns true if the field exists
- getObject() : Field
- Method returns field object
- getSecureValue() : mixed
- Getting secure value
- getSecureValues() : mixed
- Getting secure values
- getTypedValue() : mixed
- Method returns typed value
- getValuesForPrefix() : array<string|int, mixed>
- Method returns field wich names are started from $prefix
- hasCustomFields() : bool
- Method returns true if the entity has custom fields False otherwise
- hasField() : bool
- Method returns true if the field exists
- removeField() : void
- Method removes field
- setSessionId() : void
- Method sets session id
- validateFieldExistance() : void
- Method validates if the field exists
- constructControl() : Field|Control
- Factory method for creating controls
- getDateValue() : string
- Returning date value
- getExternalValue() : array<string|int, mixed>
- Returning date value
- initObject() : mixed
- Method inits control
Properties
$typeMap
Supported types
public
static array<string|int, mixed>
$typeMap
= ['file' => MezonGuiFieldInputFile::class, 'date' => MezonGuiFieldInputDate::class, 'custom' => MezonGuiFieldCustomField::class, 'header' => MezonGuiFormBuilderFormHeader::class, 'label' => MezonGuiFieldLabelField::class]
$entityName
Entity name
private
string
$entityName
= ''
$fieldObjects
List of control objects
private
array<string|int, mixed>
$fieldObjects
= []
$fields
List of fields
private
mixed
$fields
= []
$sessionId
Session Id
private
string
$sessionId
= ''
Methods
__construct()
Constructor
public
__construct([array<string|int, mixed> $fields = [] ][, string $entityName = '' ]) : mixed
Parameters
- $fields : array<string|int, mixed> = []
-
list of all fields
- $entityName : string = ''
-
entity name
Return values
mixed —fetchCustomField()
Method fetches returns custom fields for saving
public
fetchCustomField(array<string|int, mixed> &$record, string $name) : array<string|int, mixed>
Parameters
- $record : array<string|int, mixed>
-
record to be extended
- $name : string
-
name od the field
Return values
array<string|int, mixed> —extended record
fetchField()
Method fetches submitted field
public
fetchField(array<string|int, mixed> &$record, string $name) : void
Parameters
- $record : array<string|int, mixed>
-
record to be extended
- $name : string
-
name od the field
Return values
void —getCompiledField()
Method compiles field DOM
public
getCompiledField(string $name) : string
Parameters
- $name : string
-
field name
Return values
string —compiled HTML
getEntityName()
Method returns entity name
public
getEntityName() : string
Return values
string —entity name
getFields()
Getting fields
public
getFields() : array<string|int, mixed>
Return values
array<string|int, mixed> —getFieldsNames()
Method returns array of fields names
public
getFieldsNames() : array<string|int, string>
Return values
array<string|int, string> —getFieldType()
Method returns true if the field exists
public
getFieldType(string $fieldName) : string
Parameters
- $fieldName : string
-
field name
Return values
string —field type
getObject()
Method returns field object
public
getObject(string $name) : Field
Parameters
- $name : string
-
field name
Return values
Field —field object
getSecureValue()
Getting secure value
public
getSecureValue(string $field, mixed $value[, bool $storeFiles = true ]) : mixed
Parameters
- $field : string
-
field name
- $value : mixed
-
field value
- $storeFiles : bool = true
-
should we store files
Return values
mixed —secure value of the field
getSecureValues()
Getting secure values
public
getSecureValues(string $field, mixed $values[, bool $storeFiles = true ]) : mixed
Parameters
- $field : string
-
field name
- $values : mixed
-
field values
- $storeFiles : bool = true
-
should we store files
Return values
mixed —secure values of the field or one value
getTypedValue()
Method returns typed value
public
getTypedValue(string $type, string|array<string|int, mixed> $value[, bool $storeFiles = true ]) : mixed
Parameters
- $type : string
-
of the field
- $value : string|array<string|int, mixed>
-
of the field
- $storeFiles : bool = true
-
need the uploaded file to be stored
Return values
mixed —secured value
getValuesForPrefix()
Method returns field wich names are started from $prefix
public
getValuesForPrefix(string $prefix[, bool $storeFiles = true ]) : array<string|int, mixed>
Parameters
- $prefix : string
-
of the fields to be fetched
- $storeFiles : bool = true
-
should we store files
Return values
array<string|int, mixed> —fetched fields
hasCustomFields()
Method returns true if the entity has custom fields False otherwise
public
hasCustomFields() : bool
Return values
bool —true if the entity has custom fields
hasField()
Method returns true if the field exists
public
hasField(string $fieldName) : bool
Parameters
- $fieldName : string
-
field name
Return values
bool —removeField()
Method removes field
public
removeField(string $fieldName) : void
Parameters
- $fieldName : string
-
field name
Return values
void —setSessionId()
Method sets session id
public
setSessionId(string $sessionId) : void
Parameters
- $sessionId : string
-
new session id
Return values
void —validateFieldExistance()
Method validates if the field exists
public
validateFieldExistance(string $fieldName) : void
Parameters
- $fieldName : string
-
field name
Return values
void —constructControl()
Factory method for creating controls
protected
constructControl(array<string|int, mixed> $field) : Field|Control
Parameters
- $field : array<string|int, mixed>
-
field description
Return values
Field|Control —constructed control
getDateValue()
Returning date value
protected
getDateValue(string $value) : string
Parameters
- $value : string
-
value to be made secure
Return values
string —secure value
getExternalValue()
Returning date value
protected
getExternalValue(array<string|int, mixed> $value) : array<string|int, mixed>
Parameters
- $value : array<string|int, mixed>
-
value to be made secure
Return values
array<string|int, mixed> —secure value
initObject()
Method inits control
protected
initObject(array<string|int, mixed> $field) : mixed
Parameters
- $field : array<string|int, mixed>
-
field
Return values
mixed —control