JFormHelper

JForm's helper class.

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

package

Joomla.Platform

subpackage

Form

since

11.1

Methods

addFieldPath

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

addFieldPath(mixed $new = null) : array
static
since

11.1

Arguments

$new

mixedA path or array of paths to add.

Response

arrayThe list of paths that have been added.

addFormPath

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

addFormPath(mixed $new = null) : array
static
since

11.1

Arguments

$new

mixedA path or array of paths to add.

Response

arrayThe list of paths that have been added.

addPath

Method to add a path to the list of include paths for one of the form's entities.

addPath(string $entity, mixed $new = null) : array
static

Currently supported entities: field, rule and form. You are free to support your own in a subclass.

since

11.1

Arguments

$entity

stringForm's entity name for which paths will be added.

$new

mixedA path or array of paths to add.

Response

arrayThe list of paths that have been added.

addRulePath

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

addRulePath(mixed $new = null) : array
static
since

11.1

Arguments

$new

mixedA path or array of paths to add.

Response

arrayThe list of paths that have been added.

loadClass

Load a class for one of the form's entities of a particular type.

loadClass(string $entity, string $type) : mixed
static

Currently, it makes sense to use this method for the "field" and "rule" entities (but you can support more entities in your subclass).

since

11.1

Arguments

$entity

stringOne of the form entities (field or rule).

$type

stringType of an entity.

Response

mixedClass name on success or false otherwise.

loadFieldClass

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

loadFieldClass(string $type) : mixed
static

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

since

11.1

Arguments

$type

stringType of a field whose class should be loaded.

Response

mixedClass name on success or false otherwise.

loadFieldType

Method to load a form field object given a type.

loadFieldType(string $type, boolean $new = true) : mixed
static
since

11.1

Arguments

$type

stringThe field type.

$new

booleanFlag to toggle whether we should get a new instance of the object.

Response

mixedJFormField object on success, false otherwise.

loadRuleClass

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

loadRuleClass(string $type) : mixed
static

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

since

11.1

Arguments

$type

stringType of a rule whose class should be loaded.

Response

mixedClass name on success or false otherwise.

loadRuleType

Method to load a form rule object given a type.

loadRuleType(string $type, boolean $new = true) : mixed
static
since

11.1

Arguments

$type

stringThe rule type.

$new

booleanFlag to toggle whether we should get a new instance of the object.

Response

mixedJFormRule object on success, false otherwise.

loadType

Method to load a form entity object given a type.

loadType(string $entity, string $type, boolean $new = true) : mixed
static

Each type is loaded only once and then used as a prototype for other objects of same type. Please, use this method only with those entities which support types (forms don't support them).

since

11.1

Arguments

$entity

stringThe entity.

$type

stringThe entity type.

$new

booleanFlag to toggle whether we should get a new instance of the object.

Response

mixedEntity object on success, false otherwise.

Properties

paths

Array with paths where entities(field, rule, form) can be found.

static

Array's structure: paths: {ENTITY_NAME}:

  • /path/1
  • /path/2
since

11.1

Type(s)

array

entities

Static array of JForm's entity objects for re-use.

static

Prototypes for all fields and rules are here.

Array's structure: entities: {ENTITY_NAME}: {KEY}: {OBJECT}

since

11.1

Type(s)

array