NeoField
extends CraftField
in package
Handles a Neo field
Tags
Table of Contents
- $craft_field_class : string
- $craft_field_id : int
- $dateCreated : DateTime
- $dateUpdated : DateTime
- $display_id : int
- $hidden : bool
- $id : int
- $labelHidden : bool
- $labelVisuallyHidden : bool
- $type : string
- $uid : string
- $visuallyHidden : bool
- $_craftField : Field
- $_display : DisplayInterface
- $_displayer : FieldDisplayerInterface
- $_displayerHandle : string
- $_parent : FieldInterface|null
- $_types : mixed
- afterValidate() : mixed
- buildConfig() : array<string|int, mixed>
- Build config from a field
- create() : FieldInterface
- Create a new field from config
- defineRules() : array<string|int, mixed>
- delete() : bool
- Delete a field
- eagerLoad() : array<string|int, mixed>
- fields() : mixed
- forField() : string
- getAvailableDisplayers() : array<string|int, FieldDisplayerInterface>
- Get all the displayers that can display this field
- getCanBeCached() : bool
- Can this field be cached
- getChildFieldName() : string
- Get the name of a field child of this field. This would only be used for fields that have children (Neo, Matrix etc)
- getChildren() : array<string|int, mixed>
- getConfig() : array<string|int, mixed>
- Get project vonfig
- getCraftField() : Field
- Get the associated craft field instance
- getDisplay() : DisplayInterface|null
- Display getter
- getDisplayer() : FieldDisplayerInterface
- Get the displayer for this field
- getDisplayerHandle() : string
- Displayer handle getter
- getDisplayName() : string
- Name to display
- getErrors() : mixed
- getFieldByHandle() : FieldInterface|null
- getFieldByUid() : FieldInterface|null
- getFieldsByHandles() : array<string|int, mixed>
- getFieldsByUids() : array<string|int, mixed>
- getFieldTemplates() : array<string|int, string>
- Get available field templates
- getFileTemplates() : array<string|int, string>
- Get available file templates
- getHandle() : string
- getLayout() : LayoutInterface
- Layout getter
- getName() : string
- getOptions() : array<string|int, mixed>
- Options getter
- getParent() : FieldInterface|null
- Parent getter
- getRenderingValue() : mixed
- getTargetClass() : string
- The class used by displayer for their field targets Will be the field class for custom fields and the craft field class for craft fields
- getType() : string
- getTypes() : array<string|int, mixed>
- getViewMode() : ViewModeInterface
- View mode getter
- getVisibleFields() : array<string|int, mixed>
- handleChanged() : bool
- Handle a project config change
- handleDeleted() : mixed
- Deletes a field record
- hasErrors() : mixed
- isVisible() : bool
- populateFromData() : mixed
- rebuild() : mixed
- Rebuild the field
- render() : Markup
- Render this item.
- save() : bool
- Saves a field
- setDisplay() : mixed
- Display setter
- setDisplayerHandle() : mixed
- Displayer handle setter
- setOptions() : mixed
- Options setter
- setParent() : mixed
- Parent setter
- setTypes() : mixed
- shouldExistOnLayout() : bool
- Should this field exist on a layout, called during the creation of a layout to automatically create this field on that layout.
- buildNeoTypes() : array<string|int, mixed>
- Build neo block types from an array of data
Properties
$craft_field_class
public
string
$craft_field_class
$craft_field_id
public
int
$craft_field_id
$dateCreated
public
DateTime
$dateCreated
$dateUpdated
public
DateTime
$dateUpdated
$display_id
public
int
$display_id
$hidden
public
bool
$hidden
= false
$id
public
int
$id
$labelHidden
public
bool
$labelHidden
= false
$labelVisuallyHidden
public
bool
$labelVisuallyHidden
= false
$type
public
string
$type
$uid
public
string
$uid
$visuallyHidden
public
bool
$visuallyHidden
= false
$_craftField
protected
Field
$_craftField
$_display
protected
DisplayInterface
$_display
$_displayer
protected
FieldDisplayerInterface
$_displayer
$_displayerHandle
protected
string
$_displayerHandle
$_parent
protected
FieldInterface|null
$_parent
$_types
private
mixed
$_types
Methods
afterValidate()
public
afterValidate() : mixed
Tags
Return values
mixed —buildConfig()
Build config from a field
public
static buildConfig(Field $craftField) : array<string|int, mixed>
Parameters
- $craftField : Field
Tags
Return values
array<string|int, mixed> —create()
Create a new field from config
public
static create(array<string|int, mixed> $config) : FieldInterface
Parameters
- $config : array<string|int, mixed>
Tags
Return values
FieldInterface —defineRules()
public
defineRules() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —delete()
Delete a field
public
static delete(FieldInterface $field) : bool
Parameters
- $field : FieldInterface
Tags
Return values
bool —eagerLoad()
public
eagerLoad([string $prefix = '' ], int $level[, array<string|int, mixed> &$dependencies = [] ]) : array<string|int, mixed>
Parameters
- $prefix : string = ''
- $level : int
- $dependencies : array<string|int, mixed> = []
Tags
Return values
array<string|int, mixed> —fields()
public
fields() : mixed
Tags
Return values
mixed —forField()
public
static forField() : string
Tags
Return values
string —getAvailableDisplayers()
Get all the displayers that can display this field
public
getAvailableDisplayers() : array<string|int, FieldDisplayerInterface>
Tags
Return values
array<string|int, FieldDisplayerInterface> —getCanBeCached()
Can this field be cached
public
getCanBeCached() : bool
Tags
Return values
bool —getChildFieldName()
Get the name of a field child of this field. This would only be used for fields that have children (Neo, Matrix etc)
public
getChildFieldName(FieldInterface $field) : string
Parameters
- $field : FieldInterface
Tags
Return values
string —getChildren()
public
getChildren() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —getConfig()
Get project vonfig
public
getConfig() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —getCraftField()
Get the associated craft field instance
public
getCraftField() : Field
Tags
Return values
Field —getDisplay()
Display getter
public
getDisplay() : DisplayInterface|null
Tags
Return values
DisplayInterface|null —getDisplayer()
Get the displayer for this field
public
getDisplayer() : FieldDisplayerInterface
Tags
Return values
FieldDisplayerInterface —getDisplayerHandle()
Displayer handle getter
public
getDisplayerHandle() : string
Tags
Return values
string —getDisplayName()
Name to display
public
getDisplayName() : string
Tags
Return values
string —getErrors()
public
getErrors([mixed $attribute = null ]) : mixed
Parameters
- $attribute : mixed = null
Tags
Return values
mixed —getFieldByHandle()
public
getFieldByHandle(MatrixBlock $block, string $handle) : FieldInterface|null
Parameters
- $block : MatrixBlock
- $handle : string
Tags
Return values
FieldInterface|null —getFieldByUid()
public
getFieldByUid(MatrixBlock $block, string $uid) : FieldInterface|null
Parameters
- $block : MatrixBlock
- $uid : string
Tags
Return values
FieldInterface|null —getFieldsByHandles()
public
getFieldsByHandles(MatrixBlock $block, array<string|int, mixed> $handles) : array<string|int, mixed>
Parameters
- $block : MatrixBlock
- $handles : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —getFieldsByUids()
public
getFieldsByUids(MatrixBlock $block, array<string|int, mixed> $uids) : array<string|int, mixed>
Parameters
- $block : MatrixBlock
- $uids : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —getFieldTemplates()
Get available field templates
public
getFieldTemplates() : array<string|int, string>
Tags
Return values
array<string|int, string> —getFileTemplates()
Get available file templates
public
getFileTemplates(FileDisplayerInterface $displayer) : array<string|int, string>
Parameters
- $displayer : FileDisplayerInterface
Tags
Return values
array<string|int, string> —getHandle()
public
getHandle() : string
Tags
Return values
string —getLayout()
Layout getter
public
getLayout() : LayoutInterface
Tags
Return values
LayoutInterface —getName()
public
getName() : string
Tags
Return values
string —getOptions()
Options getter
public
getOptions() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —getParent()
Parent getter
public
getParent() : FieldInterface|null
Tags
Return values
FieldInterface|null —getRenderingValue()
public
getRenderingValue() : mixed
Tags
Return values
mixed —getTargetClass()
The class used by displayer for their field targets Will be the field class for custom fields and the craft field class for craft fields
public
getTargetClass() : string
Tags
Return values
string —getType()
public
static getType() : string
Tags
Return values
string —getTypes()
public
getTypes() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —getViewMode()
View mode getter
public
getViewMode() : ViewModeInterface
Tags
Return values
ViewModeInterface —getVisibleFields()
public
getVisibleFields(Block $block) : array<string|int, mixed>
Parameters
- $block : Block
Tags
Return values
array<string|int, mixed> —handleChanged()
Handle a project config change
public
static handleChanged(string $uid, array<string|int, mixed> $data) : bool
Parameters
- $uid : string
- $data : array<string|int, mixed>
Tags
Return values
bool —handleDeleted()
Deletes a field record
public
static handleDeleted(string $uid, array<string|int, mixed> $data) : mixed
Parameters
- $uid : string
- $data : array<string|int, mixed>
Tags
Return values
mixed —hasErrors()
public
hasErrors([mixed $attribute = null ]) : mixed
Parameters
- $attribute : mixed = null
Tags
Return values
mixed —isVisible()
public
isVisible() : bool
Tags
Return values
bool —populateFromData()
public
populateFromData(array<string|int, mixed> $data) : mixed
Parameters
- $data : array<string|int, mixed>
Tags
Return values
mixed —rebuild()
Rebuild the field
public
rebuild() : mixed
Tags
Return values
mixed —render()
Render this item.
public
render([mixed $value = null ]) : Markup
Parameters
- $value : mixed = null
Tags
Return values
Markup —save()
Saves a field
public
static save(FieldInterface $field) : bool
Parameters
- $field : FieldInterface
Tags
Return values
bool —setDisplay()
Display setter
public
setDisplay(DisplayInterface $display) : mixed
Parameters
- $display : DisplayInterface
Tags
Return values
mixed —setDisplayerHandle()
Displayer handle setter
public
setDisplayerHandle(string $handle) : mixed
Parameters
- $handle : string
Tags
Return values
mixed —setOptions()
Options setter
public
setOptions(mixed $options) : mixed
Parameters
- $options : mixed
Tags
Return values
mixed —setParent()
Parent setter
public
setParent(FieldInterface|null $field) : mixed
Parameters
- $field : FieldInterface|null
Tags
Return values
mixed —setTypes()
public
setTypes(array<string|int, mixed> $types) : mixed
Parameters
- $types : array<string|int, mixed>
Tags
Return values
mixed —shouldExistOnLayout()
Should this field exist on a layout, called during the creation of a layout to automatically create this field on that layout.
public
static shouldExistOnLayout(LayoutInterface $layout) : bool
Parameters
- $layout : LayoutInterface
Tags
Return values
bool —buildNeoTypes()
Build neo block types from an array of data
protected
static buildNeoTypes(array<string|int, mixed> $data, NeoField $neoField) : array<string|int, mixed>
Parameters
- $data : array<string|int, mixed>
- $neoField : NeoField