Documentation

Horde_Form_Variable
in package

This class represents a single form variable that may be rendered as one or more form fields.

Tags
author

Robert E. Coyle robertecoyle@hotmail.com

category

Horde

copyright

2001-2017 Horde LLC

license

http://www.horde.org/licenses/lgpl21 LGPL

Table of Contents

$_action  : Horde_Form_Action
A {@link Horde_Form_Action} instance.
$_arrayVal  : bool
Whether this is an array variable.
$_autofilled  : bool
TODO
$_defValue  : mixed
The default value.
$_disabled  : bool
Whether this variable is disabled.
$_hidden  : bool
Whether this is a hidden variable.
$_options  : array<string|int, mixed>
TODO
$description  : string
A long description of the variable's purpose, special instructions, etc.
$form  : Horde_Form
The form instance this variable is assigned to.
$help  : string
The variable help text.
$humanName  : string
A short description of this variable's purpose.
$readonly  : bool
Whether this is a readonly variable.
$required  : bool
Whether this is a required variable.
$type  : Horde_Form_Type
A {@link Horde_Form_Type} instance.
$varName  : string
The internally used name.
__construct()  : mixed
disable()  : mixed
Disables this variable.
getDefault()  : mixed
Returns this variable's default value.
getDescription()  : string
Returns this variable's long description.
getHelp()  : string
Returns the help text of this variable.
getHumanName()  : string
Return the short description of this variable.
getInfo()  : mixed
Processes the submitted value of this variable according to the rules of the variable type.
getOption()  : mixed
Returns a variable option's value.
getType()  : Horde_Form_Type
Returns this variable's type.
getTypeName()  : string
Returns the name of this variable's type.
getValue()  : mixed
Returns the submitted or default value of this variable.
getValues()  : array<string|int, mixed>
Returns the possible values of this variable.
getVarName()  : string
Returns the internally used variable name.
hasAction()  : bool
Returns whether this variable has an attached action.
hasDescription()  : bool
Returns whether this variable has a long description.
hasHelp()  : bool
Returns whether this variable has some help text assigned.
hide()  : mixed
Makes this a hidden variable.
Horde_Form_Variable()  : mixed
Variable constructor.
isArrayVal()  : bool
Returns whether this is an array variable.
isDisabled()  : bool
Returns whether this variable is disabled.
isHidden()  : bool
Returns whether this is a hidden variable.
isReadonly()  : bool
Returns whether this is a readonly variable.
isRequired()  : bool
Returns whether this is a required variable.
isUpload()  : bool
Returns whether this variable is to upload a file.
setAction()  : mixed
Assigns an action to this variable.
setDefault()  : mixed
Sets a default value for this variable.
setFormOb()  : mixed
Assign this variable to the specified form.
setHelp()  : mixed
Assigns a help text to this variable.
setOption()  : mixed
Sets a variable option.
validate()  : bool
Validates this variable.
wasChanged()  : bool
Returns whether this variable if it had the "trackchange" option set has actually been changed.

Properties

$_arrayVal

Whether this is an array variable.

public bool $_arrayVal

$_autofilled

TODO

public bool $_autofilled = \false

$_defValue

The default value.

public mixed $_defValue = \null

$_disabled

Whether this variable is disabled.

public bool $_disabled = \false

$_hidden

Whether this is a hidden variable.

public bool $_hidden = \false

$_options

TODO

public array<string|int, mixed> $_options = array()

$description

A long description of the variable's purpose, special instructions, etc.

public string $description

$help

The variable help text.

public string $help

$humanName

A short description of this variable's purpose.

public string $humanName

$readonly

Whether this is a readonly variable.

public bool $readonly

$required

Whether this is a required variable.

public bool $required

$varName

The internally used name.

public string $varName

Methods

__construct()

public __construct(mixed $humanName, mixed $varName, Horde_Form_Type $type, mixed $required[, mixed $readonly = false ][, mixed $description = null ]) : mixed
Parameters
$humanName : mixed
$varName : mixed
$type : Horde_Form_Type
$required : mixed
$readonly : mixed = false
$description : mixed = null
Return values
mixed

disable()

Disables this variable.

public disable() : mixed
Return values
mixed

getDefault()

Returns this variable's default value.

public getDefault() : mixed
Return values
mixed

This variable's default value.

getDescription()

Returns this variable's long description.

public getDescription() : string
Return values
string

This variable's long description.

getHelp()

Returns the help text of this variable.

public getHelp() : string
Return values
string

This variable's help text.

getHumanName()

Return the short description of this variable.

public getHumanName() : string
Return values
string

A short description

getInfo()

Processes the submitted value of this variable according to the rules of the variable type.

public getInfo(Variables &$vars, mixed &$info) : mixed
Parameters
$vars : Variables

The instance of the submitted form.

$info : mixed

A variable passed by reference that will be assigned the processed value of the submitted variable value.

Return values
mixed

Depending on the variable type.

getOption()

Returns a variable option's value.

public getOption(string $option) : mixed
Parameters
$option : string

The option name.

Return values
mixed

The option's value.

getTypeName()

Returns the name of this variable's type.

public getTypeName() : string
Return values
string

This variable's name.

getValue()

Returns the submitted or default value of this variable.

public getValue(Variables &$vars[, int $index = null ]) : mixed

If an action is attached to this variable, the value will get passed to the action object.

Parameters
$vars : Variables

The instance of the submitted form.

$index : int = null

If the variable is an array variable, this specifies the array element to return.

Return values
mixed

The variable or element value.

getValues()

Returns the possible values of this variable.

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

The possible values of this variable or null.

getVarName()

Returns the internally used variable name.

public getVarName() : string
Return values
string

This variable's internal name.

hasAction()

Returns whether this variable has an attached action.

public hasAction() : bool
Return values
bool

True if this variable has an attached action.

hasDescription()

Returns whether this variable has a long description.

public hasDescription() : bool
Return values
bool

True if this variable has a long description.

hasHelp()

Returns whether this variable has some help text assigned.

public hasHelp() : bool
Return values
bool

True if this variable has a help text.

hide()

Makes this a hidden variable.

public hide() : mixed
Return values
mixed

Horde_Form_Variable()

Variable constructor.

public static Horde_Form_Variable(string $humanName, string $varName, Horde_Form_Type $type, bool $required[, bool $readonly = false ][, string $description = null ]) : mixed
Parameters
$humanName : string

A short description of the variable's purpose.

$varName : string

The internally used name.

$type : Horde_Form_Type

A instance.

$required : bool

Whether this is a required variable.

$readonly : bool = false

Whether this is a readonly variable.

$description : string = null

A long description of the variable's purpose, special instructions, etc.

Return values
mixed

isArrayVal()

Returns whether this is an array variable.

public isArrayVal() : bool
Return values
bool

True if this an array variable.

isDisabled()

Returns whether this variable is disabled.

public isDisabled() : bool
Return values
bool

True if this variable is disabled.

isHidden()

Returns whether this is a hidden variable.

public isHidden() : bool
Return values
bool

True if this a hidden variable.

isReadonly()

Returns whether this is a readonly variable.

public isReadonly() : bool
Return values
bool

True if this a readonly variable.

isRequired()

Returns whether this is a required variable.

public isRequired() : bool
Return values
bool

True if this is a required variable.

isUpload()

Returns whether this variable is to upload a file.

public isUpload() : bool
Return values
bool

True if variable is to upload a file.

setAction()

Assigns an action to this variable.

public setAction(Horde_Form_Action $action) : mixed

Example: $v = $form->addVariable('My Variable', 'var1', 'text', false); $v->setAction(Horde_Form_Action::factory('submit'));

Parameters
$action : Horde_Form_Action

A instance.

Return values
mixed

setDefault()

Sets a default value for this variable.

public setDefault(mixed $value) : mixed
Parameters
$value : mixed

A variable value.

Return values
mixed

setFormOb()

Assign this variable to the specified form.

public setFormOb(Horde_Form &$form) : mixed
Parameters
$form : Horde_Form

The form instance to assign this variable to.

Return values
mixed

setHelp()

Assigns a help text to this variable.

public setHelp(string $help) : mixed
Parameters
$help : string

The variable help text.

Return values
mixed

setOption()

Sets a variable option.

public setOption(string $option, mixed $val) : mixed
Parameters
$option : string

The option name.

$val : mixed

The option's value.

Return values
mixed

validate()

Validates this variable.

public validate(Variables &$vars, string &$message) : bool
Parameters
$vars : Variables

The instance of the submitted form.

$message : string

A variable passed by reference that will be assigned a descriptive error message if validation failed.

Return values
bool

True if the variable validated.

wasChanged()

Returns whether this variable if it had the "trackchange" option set has actually been changed.

public wasChanged(Variables &$vars) : bool
Parameters
$vars : Variables

The instance of the submitted form.

Return values
bool

Null if this variable doesn't have the "trackchange" option set or the form wasn't submitted yet. A boolean indicating whether the variable was changed otherwise.

Search results