FieldSpec
in package
uses
BasicSpecTrait, PhpDataTypeSpecTrait, OptionsSpecTrait, ArrayFormatTrait
Table of Contents
Properties
- $comment : mixed
- $description : string
- Explanation of the purpose of the field.
- $name : string
- Symbolic name of the field.
- $options : array<string|int, mixed>|bool
- $optionsCallback : callable
- $optionsCallbackParams : array<string|int, mixed>
- $required : bool|null
- $scope : array<string|int, mixed>|null
- Allow this property to be used in alternative scopes, such as Smarty and TokenProcessor.
- $suffixes : array<string|int, mixed>|null
- $title : string
- Backend-facing label. Shown in API, exports, and other configuration systems.
- $type : array<string|int, string>
- The PHP
Methods
- getDescription() : string
- getName() : string
- getScope() : array<string|int, mixed>|null
- getTitle() : string
- getType() : array<string|int, string>
- isRequired() : bool
- loadArray() : $this
- Populate this field-spec using values from an array.
- setDescription() : $this
- setName() : $this
- setOptions() : $this
- setOptionsCallback() : $this
- setRequired() : $this
- setScope() : $this
- Enable export/import in alternative scopes.
- setSuffixes() : $this
- setTitle() : $this
- setType() : $this
- toArray() : array<string|int, mixed>
- Gets all public variables, converted to snake_case
Properties
$comment
public
mixed
$comment
$description
Explanation of the purpose of the field.
public
string
$description
$name
Symbolic name of the field.
public
string
$name
Ex: 'first_name'
$options
public
array<string|int, mixed>|bool
$options
$optionsCallback
public
callable
$optionsCallback
$optionsCallbackParams
public
array<string|int, mixed>
$optionsCallbackParams
= []
$required
public
bool|null
$required
$scope
Allow this property to be used in alternative scopes, such as Smarty and TokenProcessor.
public
array<string|int, mixed>|null
$scope
Ex: ['Smarty' => 'smarty_name']
$suffixes
public
array<string|int, mixed>|null
$suffixes
$title
Backend-facing label. Shown in API, exports, and other configuration systems.
public
string
$title
If this field is presented to an administrator (e.g. when configuring a screen or configuring process-automation), how the field be entitled?
Ex: ts('First Name')
$type
The PHP
public
array<string|int, string>
$type
Methods
getDescription()
public
getDescription() : string
Return values
stringgetName()
public
getName() : string
Return values
stringgetScope()
public
getScope() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|nullgetTitle()
public
getTitle() : string
Return values
stringgetType()
public
getType() : array<string|int, string>
Return values
array<string|int, string>isRequired()
public
isRequired() : bool
Return values
boolloadArray()
Populate this field-spec using values from an array.
public
loadArray(iterable<string|int, mixed> $values[, bool $strict = FALSE ]) : $this
Parameters
- $values : iterable<string|int, mixed>
-
List of public variables, expressed in snake_case. Ex: ['title' => 'Color', 'default_value' => '#f00']
- $strict : bool = FALSE
-
In strict mode, properties are only accepted if they are formally defined on the current class.
Return values
$thissetDescription()
public
setDescription(string $description) : $this
Parameters
- $description : string
Return values
$thissetName()
public
setName(string $name) : $this
Parameters
- $name : string
Return values
$thissetOptions()
public
setOptions(array<string|int, mixed>|bool $options) : $this
Parameters
- $options : array<string|int, mixed>|bool
Return values
$thissetOptionsCallback()
public
setOptionsCallback(callable $callback[, array<string|int, mixed> $params = [] ]) : $this
Parameters
- $callback : callable
-
Function to be called, will receive the following arguments: ($this, $values, $returnFormat, $checkPermissions, $params)
- $params : array<string|int, mixed> = []
-
Array of optional extra data; sent as 5th argument to the callback
Return values
$thissetRequired()
public
setRequired(bool|null $required) : $this
Parameters
- $required : bool|null
Return values
$thissetScope()
Enable export/import in alternative scopes.
public
setScope(string|array<string|int, mixed>|null $scope) : $this
Parameters
- $scope : string|array<string|int, mixed>|null
-
Ex: 'tplParams' Ex: 'tplParams as foo_bar' Ex: 'tplParams as contact_id, TokenProcessor as contactId' Ex: ['tplParams' => 'foo_bar']
Return values
$thissetSuffixes()
public
setSuffixes(array<string|int, mixed> $suffixes) : $this
Parameters
- $suffixes : array<string|int, mixed>
Return values
$thissetTitle()
public
setTitle(string $title) : $this
Parameters
- $title : string
Return values
$thissetType()
public
setType(string|array<string|int, string> $type) : $this
Parameters
- $type : string|array<string|int, string>
Tags
Return values
$thistoArray()
Gets all public variables, converted to snake_case
public
toArray() : array<string|int, mixed>