class FormHelper

Form's helper class.

Provides a storage for filesystem's paths where Form's entities reside and methods for creating those entities. Also stores objects with entities' prototypes for further reusing.

Methods

static  FormField|boolean
loadFieldType( string $type, boolean $new = true)

Method to load a form field object given a type.

static  FormRule|boolean
loadRuleType( string $type, boolean $new = true)

Method to load a form rule object given a type.

static  string|boolean
loadFieldClass( string $type)

Attempt to import the JFormField class file if it isn't already imported.

static  string|boolean
loadRuleClass( string $type)

Attempt to import the JFormRule class file if it isn't already imported.

static  array
addFieldPath( mixed $new = null)

Method to add a path to the list of field include paths.

static  array
addFormPath( mixed $new = null)

Method to add a path to the list of form include paths.

static  array
addRulePath( mixed $new = null)

Method to add a path to the list of rule include paths.

static  array
addFieldPrefix( mixed $new = null)

Method to add a namespace prefix to the list of field lookups.

static  array
addFormPrefix( mixed $new = null)

Method to add a namespace to the list of form lookups.

static  array
addRulePrefix( mixed $new = null)

Method to add a namespace to the list of rule lookups.

static  array
parseShowOnConditions( string $showOn, string $formControl = null, string $group = null)

Parse the show on conditions

Details

static FormField|boolean loadFieldType( string $type, boolean $new = true)

Method to load a form field object given a type.

Parameters

string $type The field type.
boolean $new Flag to toggle whether we should get a new instance of the object.

Return Value

FormField|boolean FormField object on success, false otherwise.

static FormRule|boolean loadRuleType( string $type, boolean $new = true)

Method to load a form rule object given a type.

Parameters

string $type The rule type.
boolean $new Flag to toggle whether we should get a new instance of the object.

Return Value

FormRule|boolean FormRule object on success, false otherwise.

static string|boolean loadFieldClass( string $type)

Attempt to import the JFormField class file if it isn't already imported.

You can use this method outside of JForm for loading a field for inheritance or composition.

Parameters

string $type Type of a field whose class should be loaded.

Return Value

string|boolean Class name on success or false otherwise.

static string|boolean loadRuleClass( string $type)

Attempt to import the JFormRule class file if it isn't already imported.

You can use this method outside of JForm for loading a rule for inheritance or composition.

Parameters

string $type Type of a rule whose class should be loaded.

Return Value

string|boolean Class name on success or false otherwise.

static array addFieldPath( mixed $new = null)

Method to add a path to the list of field include paths.

Parameters

mixed $new A path or array of paths to add.

Return Value

array The list of paths that have been added.

static array addFormPath( mixed $new = null)

Method to add a path to the list of form include paths.

Parameters

mixed $new A path or array of paths to add.

Return Value

array The list of paths that have been added.

static array addRulePath( mixed $new = null)

Method to add a path to the list of rule include paths.

Parameters

mixed $new A path or array of paths to add.

Return Value

array The list of paths that have been added.

static array addFieldPrefix( mixed $new = null)

Method to add a namespace prefix to the list of field lookups.

Parameters

mixed $new A namespaces or array of namespaces to add.

Return Value

array The list of namespaces that have been added.

static array addFormPrefix( mixed $new = null)

Method to add a namespace to the list of form lookups.

Parameters

mixed $new A namespace or array of namespaces to add.

Return Value

array The list of namespaces that have been added.

static array addRulePrefix( mixed $new = null)

Method to add a namespace to the list of rule lookups.

Parameters

mixed $new A namespace or array of namespaces to add.

Return Value

array The list of namespaces that have been added.

static array parseShowOnConditions( string $showOn, string $formControl = null, string $group = null)

Parse the show on conditions

Parameters

string $showOn Show on conditions.
string $formControl Form name.
string $group The dot-separated form group path.

Return Value

array Array with show on conditions.