PHP Class Jarves\Configuration\Field

Inheritance: extends Model
Show file Open project: jarves/jarves Class Usage Examples

Protected Properties

Property Type Description
$againstField string | null Works only with needValue. A field id from another field.
$arrayKey
$attribute boolean Whether this field is a attribute.
$attributes
$autoIncrement boolean
$children Field[]
$customGet string
$customSave string
$default mixed | null The default/initial value.
$description string Shows a grayed description text. Use markdown to format stuff.
$disabled boolean If this fields is disabled or not.
$field string The key of the field this is representing. Primarily for types 'predefined'.
$fieldWidth string | integer Width of the panel where the input is placed.
$help string Shows a little help icon and points to the given help id.
$id string
$inputWidth string | integer Width of the actual input element (input, select, textarea, etc)
$label string The label.
$layout string Not in use.
$maxLength integer
$needValue string | null Per default, this is checked against the parent (when this field is in a children section of another field), however, you can change that by using againstField.
$noWrapper boolean If this fields contains a default wrapper div with title, description etc or only the input itself.
$object string
$objectLabel string
$objectRefRelationName string The virtualField name of the field in the foreign object pointing to us back.
$objectRelation string \Jarves\ORM\ORMAbstract:: MANY_TO_ONE = 'nTo1', ONE_TO_MANY = '1ToN', ONE_TO_ONE = '1To1', MANY_TO_MANY = 'nToM';
$objectRelationCrossObjectKey string The object name of the cross-table of a nToM relation.
$objectRelationOnDelete string onDelete cascade|setnull|restrict|none
$objectRelationOnUpdate string onUpdate cascade|setnull|restrict|none
$objectRelationTable string The table name of the middle-table of a nToM relation.
$objectRelationWithConstraint boolean If the storage backend should also create a constraint so its not possible to pass a invalid reference id.
$options Options
$primaryKey boolean
$required boolean Defines if this field needs a valid value.
$requiredRegex string
$returnDefault boolean If this field returns the value even though it's the default value (in a form).
$saveOnlyFilled boolean
$startEmpty boolean If this field starts with a empty value (on initialisation). (Good fit for password fields)
$tableItem boolean If this field injects a tr+2xtd instead of div.
$target string Only used when this field is a object attribute (extends another foreign object)
$type string
$virtual boolean Virtual fields are not exported to the configuration xml.
$width integer | string Width of a column.

Public Methods

Method Description
__sleep ( )
bootRunTime ( Object $object, Configs $configs ) Do whatever is needed to setup the runtime environment correctly.
canPropertyBeExported ( $k )
fromArray ( array $values, string $key = null )
getAgainstField ( ) : string
getAttribute ( ) : boolean
getAutoIncrement ( ) : boolean
getChildren ( ) : Field[]
getChildrenArray ( ) : array
getColumnName ( ) : string Returns the column name for database access.
getCustomGet ( ) : string
getCustomSave ( ) : string
getDefault ( ) : mixed
getDescription ( ) : string
getDisabled ( ) : boolean
getField ( ) : string
getFieldType ( ) : Jarves\Admin\FieldTypes\TypeInterface
getFieldWidth ( ) : integer | string
getForm ( ) : Form
getHelp ( ) : string
getId ( ) : string
getInputWidth ( ) : integer | string
getLabel ( ) : string
getLayout ( ) : string
getMaxLength ( ) : integer
getNeedValue ( ) : mixed
getNoWrapper ( ) : boolean
getObject ( ) : string
getObjectDefinition ( ) : Object
getObjectLabel ( ) : string
getObjectRefRelationName ( ) : string
getObjectRelation ( ) : string
getObjectRelationCrossObjectKey ( ) : string
getObjectRelationOnDelete ( ) : string
getObjectRelationOnUpdate ( ) : string
getObjectRelationTable ( ) : string
getObjectRelationWithConstraint ( ) : boolean If the storage backend should also create a constraint so its not possible to pass a invalid reference id.
getOption ( string $key ) : mixed
getOptions ( ) : Options
getParentField ( ) : Field
getPhpDataType ( ) : string Returns the internal data type.
getPrimaryKey ( ) : boolean
getRequired ( ) : boolean
getRequiredRegex ( ) : string
getReturnDefault ( ) : boolean
getSaveOnlyFilled ( ) : boolean
getStartEmpty ( ) : boolean
getTableItem ( ) : mixed
getTarget ( ) : string
getType ( ) : string
getValue ( ) : mixed
getVirtual ( ) : boolean
getWidth ( ) : integer | string
hasFieldType ( ) : boolean
isAttribute ( ) : boolean
isAutoIncrement ( ) : boolean
isHidden ( ) : boolean Hidden means here if the needValue is correct with the value of parent or getAgainstField.
isObjectRelationWithConstraint ( ) : boolean If the storage backend should also create a constraint so its not possible to pass a invalid reference id.
isPrimaryKey ( ) : boolean
isRequired ( ) : boolean
isVirtual ( ) : boolean
mapValues ( array &$data )
setAgainstField ( string $againstField )
setAttribute ( boolean $attribute )
setAutoIncrement ( boolean $autoIncrement )
setChildren ( array $children = null )
setCustomGet ( string $customGet )
setCustomSave ( string $customSave )
setDefault ( mixed $default )
setDescription ( string $description )
setDisabled ( boolean $disabled )
setField ( string $field )
setFieldType ( Jarves\Admin\FieldTypes\TypeInterface $fieldType )
setFieldWidth ( integer | string $fieldWidth )
setForm ( Form $form )
setHelp ( string $help )
setId ( string $id )
setInputWidth ( integer | string $inputWidth )
setLabel ( string $label )
setLayout ( string $layout )
setMaxLength ( integer $maxLength )
setNeedValue ( mixed $needValue )
setNoWrapper ( boolean $noWrapper )
setObject ( string $object )
setObjectDefinition ( Object $objectDefinition )
setObjectLabel ( string $objectLabel )
setObjectRefRelationName ( string $objectRefRelationName )
setObjectRelation ( string $objectRelation )
setObjectRelationCrossObjectKey ( string $objectRelationPhpName )
setObjectRelationOnDelete ( string $objectRelationOnDelete )
setObjectRelationOnUpdate ( string $objectRelationOnUpdate )
setObjectRelationTable ( string $objectRelationTable )
setObjectRelationWithConstraint ( boolean $objectRelationWithConstraint )
setOption ( $key, $value )
setOptions ( Options $options )
setParentField ( Field $parentField )
setPrimaryKey ( boolean $primaryKey )
setRequired ( boolean $required )
setRequiredRegex ( string $requiredRegex )
setReturnDefault ( boolean $returnDefault )
setSaveOnlyFilled ( boolean $saveOnlyFilled )
setStartEmpty ( boolean $startEmpty )
setTableItem ( mixed $tableItem )
setTarget ( string $target )
setType ( string $type )
setValue ( mixed $value )
setVirtual ( boolean $virtual )
setWidth ( integer | string $width )
toArray ( boolean $printDefaults = false ) : array
validate ( ) : boolean

Method Details

__sleep() public method

public __sleep ( )

bootRunTime() public method

e.g. create cross foreignKeys for 1-to-n relations.
public bootRunTime ( Object $object, Configs $configs )
$object Object
$configs Configs

canPropertyBeExported() public method

public canPropertyBeExported ( $k )

fromArray() public method

public fromArray ( array $values, string $key = null )
$values array
$key string

getAgainstField() public method

public getAgainstField ( ) : string
return string

getAttribute() public method

public getAttribute ( ) : boolean
return boolean

getAutoIncrement() public method

public getAutoIncrement ( ) : boolean
return boolean

getChildren() public method

public getChildren ( ) : Field[]
return Field[]

getChildrenArray() public method

public getChildrenArray ( ) : array
return array

getColumnName() public method

Returns the column name for database access.
public getColumnName ( ) : string
return string

getCustomGet() public method

public getCustomGet ( ) : string
return string

getCustomSave() public method

public getCustomSave ( ) : string
return string

getDefault() public method

public getDefault ( ) : mixed
return mixed

getDescription() public method

public getDescription ( ) : string
return string

getDisabled() public method

public getDisabled ( ) : boolean
return boolean

getField() public method

public getField ( ) : string
return string

getFieldType() public method

public getFieldType ( ) : Jarves\Admin\FieldTypes\TypeInterface
return Jarves\Admin\FieldTypes\TypeInterface

getFieldWidth() public method

public getFieldWidth ( ) : integer | string
return integer | string

getForm() public method

public getForm ( ) : Form
return Jarves\Admin\Form\Form

getHelp() public method

public getHelp ( ) : string
return string

getId() public method

public getId ( ) : string
return string

getInputWidth() public method

public getInputWidth ( ) : integer | string
return integer | string

getLabel() public method

public getLabel ( ) : string
return string

getLayout() public method

public getLayout ( ) : string
return string

getMaxLength() public method

public getMaxLength ( ) : integer
return integer

getNeedValue() public method

public getNeedValue ( ) : mixed
return mixed

getNoWrapper() public method

public getNoWrapper ( ) : boolean
return boolean

getObject() public method

public getObject ( ) : string
return string

getObjectDefinition() public method

public getObjectDefinition ( ) : Object
return Object

getObjectLabel() public method

public getObjectLabel ( ) : string
return string

getObjectRefRelationName() public method

public getObjectRefRelationName ( ) : string
return string

getObjectRelation() public method

public getObjectRelation ( ) : string
return string

getObjectRelationCrossObjectKey() public method

getObjectRelationOnDelete() public method

getObjectRelationOnUpdate() public method

getObjectRelationTable() public method

public getObjectRelationTable ( ) : string
return string

getObjectRelationWithConstraint() public method

If the storage backend should also create a constraint so its not possible to pass a invalid reference id.

getOption() public method

public getOption ( string $key ) : mixed
$key string
return mixed

getOptions() public method

public getOptions ( ) : Options
return Options

getParentField() public method

public getParentField ( ) : Field
return Field

getPhpDataType() public method

Returns the internal data type.
public getPhpDataType ( ) : string
return string

getPrimaryKey() public method

public getPrimaryKey ( ) : boolean
return boolean

getRequired() public method

public getRequired ( ) : boolean
return boolean

getRequiredRegex() public method

public getRequiredRegex ( ) : string
return string

getReturnDefault() public method

public getReturnDefault ( ) : boolean
return boolean

getSaveOnlyFilled() public method

public getSaveOnlyFilled ( ) : boolean
return boolean

getStartEmpty() public method

public getStartEmpty ( ) : boolean
return boolean

getTableItem() public method

public getTableItem ( ) : mixed
return mixed

getTarget() public method

public getTarget ( ) : string
return string

getType() public method

public getType ( ) : string
return string

getValue() public method

public getValue ( ) : mixed
return mixed

getVirtual() public method

public getVirtual ( ) : boolean
return boolean

getWidth() public method

public getWidth ( ) : integer | string
return integer | string

hasFieldType() public method

public hasFieldType ( ) : boolean
return boolean

isAttribute() public method

public isAttribute ( ) : boolean
return boolean

isAutoIncrement() public method

public isAutoIncrement ( ) : boolean
return boolean

isHidden() public method

Hidden means here if the needValue is correct with the value of parent or getAgainstField.
public isHidden ( ) : boolean
return boolean

isObjectRelationWithConstraint() public method

If the storage backend should also create a constraint so its not possible to pass a invalid reference id.

isPrimaryKey() public method

public isPrimaryKey ( ) : boolean
return boolean

isRequired() public method

public isRequired ( ) : boolean
return boolean

isVirtual() public method

public isVirtual ( ) : boolean
return boolean

mapValues() public method

public mapValues ( array &$data )
$data array

setAgainstField() public method

public setAgainstField ( string $againstField )
$againstField string

setAttribute() public method

public setAttribute ( boolean $attribute )
$attribute boolean

setAutoIncrement() public method

public setAutoIncrement ( boolean $autoIncrement )
$autoIncrement boolean

setChildren() public method

public setChildren ( array $children = null )
$children array

setCustomGet() public method

public setCustomGet ( string $customGet )
$customGet string

setCustomSave() public method

public setCustomSave ( string $customSave )
$customSave string

setDefault() public method

public setDefault ( mixed $default )
$default mixed

setDescription() public method

public setDescription ( string $description )
$description string

setDisabled() public method

public setDisabled ( boolean $disabled )
$disabled boolean

setField() public method

public setField ( string $field )
$field string

setFieldType() public method

public setFieldType ( Jarves\Admin\FieldTypes\TypeInterface $fieldType )
$fieldType Jarves\Admin\FieldTypes\TypeInterface

setFieldWidth() public method

public setFieldWidth ( integer | string $fieldWidth )
$fieldWidth integer | string

setForm() public method

public setForm ( Form $form )
$form Jarves\Admin\Form\Form

setHelp() public method

public setHelp ( string $help )
$help string

setId() public method

public setId ( string $id )
$id string

setInputWidth() public method

public setInputWidth ( integer | string $inputWidth )
$inputWidth integer | string

setLabel() public method

public setLabel ( string $label )
$label string

setLayout() public method

public setLayout ( string $layout )
$layout string

setMaxLength() public method

public setMaxLength ( integer $maxLength )
$maxLength integer

setNeedValue() public method

public setNeedValue ( mixed $needValue )
$needValue mixed

setNoWrapper() public method

public setNoWrapper ( boolean $noWrapper )
$noWrapper boolean

setObject() public method

public setObject ( string $object )
$object string

setObjectDefinition() public method

public setObjectDefinition ( Object $objectDefinition )
$objectDefinition Object

setObjectLabel() public method

public setObjectLabel ( string $objectLabel )
$objectLabel string

setObjectRefRelationName() public method

public setObjectRefRelationName ( string $objectRefRelationName )
$objectRefRelationName string

setObjectRelation() public method

public setObjectRelation ( string $objectRelation )
$objectRelation string

setObjectRelationCrossObjectKey() public method

public setObjectRelationCrossObjectKey ( string $objectRelationPhpName )
$objectRelationPhpName string

setObjectRelationOnDelete() public method

public setObjectRelationOnDelete ( string $objectRelationOnDelete )
$objectRelationOnDelete string

setObjectRelationOnUpdate() public method

public setObjectRelationOnUpdate ( string $objectRelationOnUpdate )
$objectRelationOnUpdate string

setObjectRelationTable() public method

public setObjectRelationTable ( string $objectRelationTable )
$objectRelationTable string

setObjectRelationWithConstraint() public method

public setObjectRelationWithConstraint ( boolean $objectRelationWithConstraint )
$objectRelationWithConstraint boolean

setOption() public method

public setOption ( $key, $value )
$key
$value

setOptions() public method

public setOptions ( Options $options )
$options Options

setParentField() public method

public setParentField ( Field $parentField )
$parentField Field

setPrimaryKey() public method

public setPrimaryKey ( boolean $primaryKey )
$primaryKey boolean

setRequired() public method

public setRequired ( boolean $required )
$required boolean

setRequiredRegex() public method

public setRequiredRegex ( string $requiredRegex )
$requiredRegex string

setReturnDefault() public method

public setReturnDefault ( boolean $returnDefault )
$returnDefault boolean

setSaveOnlyFilled() public method

public setSaveOnlyFilled ( boolean $saveOnlyFilled )
$saveOnlyFilled boolean

setStartEmpty() public method

public setStartEmpty ( boolean $startEmpty )
$startEmpty boolean

setTableItem() public method

public setTableItem ( mixed $tableItem )
$tableItem mixed

setTarget() public method

public setTarget ( string $target )
$target string

setType() public method

public setType ( string $type )
$type string

setValue() public method

public setValue ( mixed $value )
$value mixed

setVirtual() public method

public setVirtual ( boolean $virtual )
$virtual boolean

setWidth() public method

public setWidth ( integer | string $width )
$width integer | string

toArray() public method

public toArray ( boolean $printDefaults = false ) : array
$printDefaults boolean
return array

validate() public method

public validate ( ) : boolean
return boolean

Property Details

$againstField protected property

Works only with needValue. A field id from another field.
protected string|null $againstField
return string | null

$arrayKey protected property

protected $arrayKey

$attribute protected property

Whether this field is a attribute.
protected bool $attribute
return boolean

$attributes protected property

protected $attributes

$autoIncrement protected property

protected bool $autoIncrement
return boolean

$children protected property

protected Field[],Jarves\Configuration $children
return Field[]

$customGet protected property

protected string $customGet
return string

$customSave protected property

protected string $customSave
return string

$default protected property

The default/initial value.
protected mixed|null $default
return mixed | null

$description protected property

Shows a grayed description text. Use markdown to format stuff.
protected string $description
return string

$disabled protected property

If this fields is disabled or not.
protected bool $disabled
return boolean

$field protected property

The key of the field this is representing. Primarily for types 'predefined'.
protected string $field
return string

$fieldWidth protected property

Width of the panel where the input is placed.
protected string|int $fieldWidth
return string | integer

$help protected property

Shows a little help icon and points to the given help id.
protected string $help
return string

$id protected property

protected string $id
return string

$inputWidth protected property

Width of the actual input element (input, select, textarea, etc)
protected string|int $inputWidth
return string | integer

$label protected property

The label.
protected string $label
return string

$layout protected property

Not in use.
protected string $layout
return string

$maxLength protected property

protected int $maxLength
return integer

$needValue protected property

Per default, this is checked against the parent (when this field is in a children section of another field), however, you can change that by using againstField.
protected string|null $needValue
return string | null

$noWrapper protected property

If this fields contains a default wrapper div with title, description etc or only the input itself.
protected bool $noWrapper
return boolean

$object protected property

protected string $object
return string

$objectLabel protected property

protected string $objectLabel
return string

$objectRefRelationName protected property

The virtualField name of the field in the foreign object pointing to us back.
protected string $objectRefRelationName
return string

$objectRelation protected property

\Jarves\ORM\ORMAbstract:: MANY_TO_ONE = 'nTo1', ONE_TO_MANY = '1ToN', ONE_TO_ONE = '1To1', MANY_TO_MANY = 'nToM';
protected string $objectRelation
return string

$objectRelationCrossObjectKey protected property

The object name of the cross-table of a nToM relation.
protected string $objectRelationCrossObjectKey
return string

$objectRelationOnDelete protected property

onDelete cascade|setnull|restrict|none
protected string $objectRelationOnDelete
return string

$objectRelationOnUpdate protected property

onUpdate cascade|setnull|restrict|none
protected string $objectRelationOnUpdate
return string

$objectRelationTable protected property

The table name of the middle-table of a nToM relation.
protected string $objectRelationTable
return string

$objectRelationWithConstraint protected property

If the storage backend should also create a constraint so its not possible to pass a invalid reference id.
protected bool $objectRelationWithConstraint
return boolean

$options protected property

protected Options,Jarves\Configuration $options
return Options

$primaryKey protected property

protected bool $primaryKey
return boolean

$required protected property

Defines if this field needs a valid value.
protected bool $required
return boolean

$requiredRegex protected property

protected string $requiredRegex
return string

$returnDefault protected property

If this field returns the value even though it's the default value (in a form).
protected bool $returnDefault
return boolean

$saveOnlyFilled protected property

protected bool $saveOnlyFilled
return boolean

$startEmpty protected property

If this field starts with a empty value (on initialisation). (Good fit for password fields)
protected bool $startEmpty
return boolean

$tableItem protected property

If this field injects a tr+2xtd instead of div.
protected bool $tableItem
return boolean

$target protected property

Only used when this field is a object attribute (extends another foreign object)
protected string $target
return string

$type protected property

protected string $type
return string

$virtual protected property

Virtual fields are not exported to the configuration xml.
protected bool $virtual
return boolean

$width protected property

Width of a column.
protected int|string $width
return integer | string