Documentation

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

$description

Explanation of the purpose of the field.

public string $description

$name

Symbolic name of the field.

public string $name

Ex: 'first_name'

$optionsCallbackParams

public array<string|int, mixed> $optionsCallbackParams = []

$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']

$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')

Methods

getDescription()

public getDescription() : string
Return values
string

getScope()

public getScope() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|null

getType()

public getType() : array<string|int, string>
Return values
array<string|int, string>

isRequired()

public isRequired() : bool
Return values
bool

loadArray()

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
$this

setDescription()

public setDescription(string $description) : $this
Parameters
$description : string
Return values
$this

setName()

public setName(string $name) : $this
Parameters
$name : string
Return values
$this

setOptions()

public setOptions(array<string|int, mixed>|bool $options) : $this
Parameters
$options : array<string|int, mixed>|bool
Return values
$this

setOptionsCallback()

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
$this

setRequired()

public setRequired(bool|null $required) : $this
Parameters
$required : bool|null
Return values
$this

setScope()

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
$this

setSuffixes()

public setSuffixes(array<string|int, mixed> $suffixes) : $this
Parameters
$suffixes : array<string|int, mixed>
Return values
$this

setTitle()

public setTitle(string $title) : $this
Parameters
$title : string
Return values
$this

setType()

public setType(string|array<string|int, string> $type) : $this
Parameters
$type : string|array<string|int, string>
Tags
throws
Exception
Return values
$this

toArray()

Gets all public variables, converted to snake_case

public toArray() : array<string|int, mixed>
Return values
array<string|int, mixed>

        
On this page

Search results