Craft Themes (4.x)

Stock extends Field
in package

Handles the stock of variants or products

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
afterValidate()  : mixed
create()  : FieldInterface
Create a new field from config
defineRules()  : array<string|int, mixed>
delete()  : bool
Delete a field
eagerLoad()  : array<string|int, mixed>
fields()  : array<string|int, mixed>
forField()  : string
For which craft field class this field should be used
getAvailableDisplayers()  : array<string|int, FieldDisplayerInterface>
Get all the displayers that can display this field
getCanBeCached()  : bool
Can this field be cached
getChildren()  : array<string|int, mixed>
Get this field's children
getConfig()  : array<string|int, mixed>
Get project vonfig
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
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
getViewMode()  : ViewModeInterface
View mode getter
handleChanged()  : bool
Handle a project config change
handleDeleted()  : mixed
Deletes a field record
hasErrors()  : bool
isVisible()  : bool
populateFromData()  : mixed
Populate this field from array of data
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
shouldExistOnLayout()  : bool
Should this field exist on a layout, called during the creation of a layout to automatically create this field on that layout.

Properties

$craft_field_class

public string $craft_field_class

$craft_field_id

public int $craft_field_id

$labelVisuallyHidden

public bool $labelVisuallyHidden = false

$_craftField

protected Field $_craftField

$_displayerHandle

protected string $_displayerHandle

Methods

afterValidate()

public afterValidate() : mixed
Tags
inheritDoc
Return values
mixed

create()

Create a new field from config

public static create(array<string|int, mixed> $config) : FieldInterface
Parameters
$config : array<string|int, mixed>
Tags
inheritDoc
Return values
FieldInterface

defineRules()

public defineRules() : array<string|int, mixed>
Tags
inheritDoc
Return values
array<string|int, mixed>

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
inheritDoc
Return values
array<string|int, mixed>

fields()

public fields() : array<string|int, mixed>
Tags
inheritDoc
Return values
array<string|int, mixed>

forField()

For which craft field class this field should be used

public static forField() : string
Tags
inheritDoc
Return values
string

getCanBeCached()

Can this field be cached

public getCanBeCached() : bool
Tags
inheritDoc
Return values
bool

getChildren()

Get this field's children

public getChildren() : array<string|int, mixed>
Tags
inheritDoc
Return values
array<string|int, mixed>

getConfig()

Get project vonfig

public getConfig() : array<string|int, mixed>
Tags
inheritDoc
Return values
array<string|int, mixed>

getDisplayerHandle()

Displayer handle getter

public getDisplayerHandle() : string
Tags
inheritDoc
Return values
string

getDisplayName()

Name to display

public getDisplayName() : string
Tags
inheritDoc
Return values
string

getErrors()

public getErrors([mixed $attribute = null ]) : mixed
Parameters
$attribute : mixed = null
Tags
inheritDoc
Return values
mixed

getFieldTemplates()

Get available field templates

public getFieldTemplates() : array<string|int, string>
Tags
inheritDoc
Return values
array<string|int, string>

getHandle()

public getHandle() : string
Tags
inheritDoc
Return values
string

getName()

public getName() : string
Tags
inheritDoc
Return values
string

getOptions()

Options getter

public getOptions() : array<string|int, mixed>
Tags
inheritDoc
Return values
array<string|int, mixed>

getRenderingValue()

public getRenderingValue() : mixed
Tags
inheritDoc
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
inheritDoc
Return values
string

getType()

public static getType() : string
Tags
inheritDoc
Return values
string

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
inheritDoc
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
inheritDoc
Return values
mixed

hasErrors()

public hasErrors([mixed $attribute = null ]) : bool
Parameters
$attribute : mixed = null
Tags
inheritDoc
Return values
bool

isVisible()

public isVisible() : bool
Tags
inheritDoc
Return values
bool

populateFromData()

Populate this field from array of data

public populateFromData(array<string|int, mixed> $data) : mixed
Parameters
$data : array<string|int, mixed>
Tags
inheritDoc
Return values
mixed

rebuild()

Rebuild the field

public rebuild() : mixed
Tags
inheritDoc
Return values
mixed

render()

Render this item.

public render([mixed $value = null ]) : Markup
Parameters
$value : mixed = null
Tags
inheritDoc
Return values
Markup

setDisplayerHandle()

Displayer handle setter

public setDisplayerHandle(string $handle) : mixed
Parameters
$handle : string
Tags
inheritDoc
Return values
mixed

setOptions()

Options setter

public setOptions(mixed $options) : mixed
Parameters
$options : mixed
Tags
inheritDoc
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
inheritDoc
Return values
bool

Search results