Properties

$form

$form : \Horde_Form

The form instance this variable is assigned to.

Type

\Horde_Form

$humanName

$humanName : string

A short description of this variable's purpose.

Type

string

$varName

$varName : string

The internally used name.

Type

string

$type

$type : \Horde_Form_Type

A {@link Horde_Form_Type} instance.

Type

\Horde_Form_Type

$required

$required : boolean

Whether this is a required variable.

Type

boolean

$readonly

$readonly : boolean

Whether this is a readonly variable.

Type

boolean

$description

$description : string

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

Type

string

$help

$help : string

The variable help text.

Type

string

$_arrayVal

$_arrayVal : boolean

Whether this is an array variable.

Type

boolean

$_defValue

$_defValue : mixed

The default value.

Type

mixed

$_action

$_action : \Horde_Form_Action

A {@link Horde_Form_Action} instance.

Type

\Horde_Form_Action

$_disabled

$_disabled : boolean

Whether this variable is disabled.

Type

boolean

$_autofilled

$_autofilled : boolean

TODO

Type

boolean

$_hidden

$_hidden : boolean

Whether this is a hidden variable.

Type

boolean

$_options

$_options : array

TODO

Type

array

Methods

Horde_Form_Variable()

Horde_Form_Variable(string  $humanName, string  $varName, \Horde_Form_Type  $type, boolean  $required, boolean  $readonly = false, string  $description = null) 

Variable constructor.

Parameters

string $humanName

A short description of the variable's purpose.

string $varName

The internally used name.

\Horde_Form_Type $type

A {@link Horde_Form_Type} instance.

boolean $required

Whether this is a required variable.

boolean $readonly

Whether this is a readonly variable.

string $description

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

setFormOb()

setFormOb(\Horde_Form  $form) 

Assign this variable to the specified form.

Parameters

\Horde_Form $form

The form instance to assign this variable to.

setDefault()

setDefault(mixed  $value) 

Sets a default value for this variable.

Parameters

mixed $value

A variable value.

getDefault()

getDefault() : mixed

Returns this variable's default value.

Returns

mixed —

This variable's default value.

setAction()

setAction(\Horde_Form_Action  $action) 

Assigns an action to this variable.

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

Parameters

\Horde_Form_Action $action

A {@link Horde_Form_Action} instance.

hasAction()

hasAction() : boolean

Returns whether this variable has an attached action.

Returns

boolean —

True if this variable has an attached action.

hide()

hide() 

Makes this a hidden variable.

isHidden()

isHidden() : boolean

Returns whether this is a hidden variable.

Returns

boolean —

True if this a hidden variable.

disable()

disable() 

Disables this variable.

isDisabled()

isDisabled() : boolean

Returns whether this variable is disabled.

Returns

boolean —

True if this variable is disabled.

getHumanName()

getHumanName() : string

Return the short description of this variable.

Returns

string —

A short description

getVarName()

getVarName() : string

Returns the internally used variable name.

Returns

string —

This variable's internal name.

getType()

getType() : \Horde_Form_Type

Returns this variable's type.

Returns

\Horde_Form_Type

This variable's {@link Horde_Form_Type} instance.

getTypeName()

getTypeName() : string

Returns the name of this variable's type.

Returns

string —

This variable's {@link Horde_Form_Type} name.

isRequired()

isRequired() : boolean

Returns whether this is a required variable.

Returns

boolean —

True if this is a required variable.

isReadonly()

isReadonly() : boolean

Returns whether this is a readonly variable.

Returns

boolean —

True if this a readonly variable.

getValues()

getValues() : array

Returns the possible values of this variable.

Returns

array —

The possible values of this variable or null.

hasDescription()

hasDescription() : boolean

Returns whether this variable has a long description.

Returns

boolean —

True if this variable has a long description.

getDescription()

getDescription() : string

Returns this variable's long description.

Returns

string —

This variable's long description.

isArrayVal()

isArrayVal() : boolean

Returns whether this is an array variable.

Returns

boolean —

True if this an array variable.

isUpload()

isUpload() : boolean

Returns whether this variable is to upload a file.

Returns

boolean —

True if variable is to upload a file.

setHelp()

setHelp(string  $help) 

Assigns a help text to this variable.

Parameters

string $help

The variable help text.

hasHelp()

hasHelp() : boolean

Returns whether this variable has some help text assigned.

Returns

boolean —

True if this variable has a help text.

getHelp()

getHelp() : string

Returns the help text of this variable.

Returns

string —

This variable's help text.

setOption()

setOption(string  $option, mixed  $val) 

Sets a variable option.

Parameters

string $option

The option name.

mixed $val

The option's value.

getOption()

getOption(string  $option) : mixed

Returns a variable option's value.

Parameters

string $option

The option name.

Returns

mixed —

The option's value.

getInfo()

getInfo(\Variables  $vars, mixed  $info) : mixed

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

Parameters

\Variables $vars

The {@link Variables} instance of the submitted form.

mixed $info

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

Returns

mixed —

Depending on the variable type.

wasChanged()

wasChanged(\Variables  $vars) : boolean

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

Parameters

\Variables $vars

The {@link Variables} instance of the submitted form.

Returns

boolean —

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.

validate()

validate(\Variables  $vars, string  $message) : boolean

Validates this variable.

Parameters

\Variables $vars

The {@link Variables} instance of the submitted form.

string $message

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

Returns

boolean —

True if the variable validated.

getValue()

getValue(\Variables  $vars, integer  $index = null) : mixed

Returns the submitted or default value of this variable.

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

Parameters

\Variables $vars

The {@link Variables} instance of the submitted form.

integer $index

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

Returns

mixed —

The variable or element value.