class FormElementHelper (View source)

Provides common functionality for form elements.

Methods

static array
getElementByName(string $name, array $form)

Retrieves a form element.

static string
getElementTitle(array $element)

Returns the title for the element.

Details

static array getElementByName(string $name, array $form)

Retrieves a form element.

Parameters

string $name

The name of the form element. If the #parents property of your form element is ['foo', 'bar', 'baz'] then the name is 'foo][bar][baz'.

array $form

An associative array containing the structure of the form.

Return Value

array

The form element.

static string getElementTitle(array $element)

Returns the title for the element.

If the element has no title, this will recurse through all children of the element until a title is found.

Parameters

array $element

An associative array containing the properties of the form element.

Return Value

string

The title of the element, or an empty string if none is found.