A less primitive form element used as a base to extend into a variety of elements containing properties and methods used by all physical form elements.

package FormItBuilder

 Methods

FormItBuilder_element

__construct(string $id, string $label) 

Main element constructor.

Parameters

$id

string

$label

string

getDescription()

getDescription() : string

Returns the form elements description.

Returns

string

getId()

getId() : string

Returns the form elements ID.

Returns

string

getLabel()

getLabel() : string

Returns the form elements label.

Returns

string

getName()

getName() : string

Returns the form elements name.

Returns

string

isRequired($value) / isRequired()

isRequired(boolean $value) : boolean

Sets wether the element is required or not.

This setting is generally toggled automatically based on FormRule settings applied in the form.

If no value passed the method will return the current required status.

Parameters

$value

boolean

If true the field must be filled out.

Returns

boolean

setDescription($value)

setDescription(string $value) 

Allows a sub label (or more descriptive label) to be set within the element label. Could be shown on hover or displayed with main label.

Parameters

$value

string

setId($value)

setId(string $value) 

Sets the form elements ID.

Parameters

$value

string

setLabel($value)

setLabel(string $value) 

Sets the form elements label.

Parameters

$value

string

setName($value)

setName(string $value) 

Sets the form elements name.

Parameters

$value

string

showInEmail($value) / showInEmail()

showInEmail(boolean $value) : boolean

Sets wether the element is shown in the email or not.

In some cases fields may be wanted in the form, but not in the email (an example would be fields like a "Confirm Password" field).

If no value passed the method will return the current status.

Parameters

$value

boolean

If true (which is in most cases default) the element will be shown in the email.

Returns

boolean

showLabel($value) / showLabel()

showLabel(boolean $value) : boolean

Sets wether the label should be displayed for this element or not. If no value passed the method will return the current status.

Parameters

$value

boolean

If true (which is in most cases default) a label will be shown next to the form element and in the email.

Returns

boolean

output function called when generating the form element content.

outputHTML() : string

Returns

string