Since: 1.6

class ModuleorderField extends FormField

Module Order field.

Traits

DatabaseAwareTrait

Trait for classes which require a user to work with.

Properties

protected string Since: 1.7.0
$description

The description text for the form field. Usually used in tooltips.

from  FormField
protected string Since: 3.2
$hint

The hint text for the form field used to display hint inside the field.

from  FormField
protected mixed Since: 3.2
$autocomplete

The autocomplete state for the form field. If 'off' element will not be automatically completed by browser.

from  FormField
protected bool Since: 3.2
$spellcheck

The spellcheck state for the form field.

from  FormField
protected bool Since: 3.2
$autofocus

The autofocus request for the form field. If true element will be automatically focused on document load.

from  FormField
protected SimpleXMLElement Since: 1.7.0
$element

The SimpleXMLElement object of the <field> XML element that describes the form field.

from  FormField
protected Form Since: 1.7.0
$form

The Form object of the form attached to the form field.

from  FormField
protected string Since: 1.7.0
$formControl

The form control prefix for field names from the Form object attached to the form field.

from  FormField
protected bool Since: 1.7.0
$hidden

The hidden state for the form field.

from  FormField
protected bool Since: 4.0.0
$hiddenLabel

Should the label be hidden when rendering the form field? This may be useful if you have the label rendering in a legend in your form field itself for radio buttons in a fieldset etc.

from  FormField
protected bool Since: 4.0.0
$hiddenDescription

Should the description be hidden when rendering the form field? This may be useful if you have the description rendering in your form field itself for e.g. note fields.

from  FormField
protected bool Since: 1.7.0
$translateLabel

True to translate the field label string.

from  FormField
protected bool Since: 1.7.0
$translateDescription

True to translate the field description string.

from  FormField
protected bool Since: 3.2
$translateHint

True to translate the field hint string.

from  FormField
protected string Since: 1.7.0
$id

The document id for the form field.

from  FormField
protected string Since: 1.7.0
$input

The input for the form field.

from  FormField
protected string Since: 1.7.0
$label

The label for the form field.

from  FormField
protected bool Since: 1.7.0
$multiple

The multiple state for the form field. If true then multiple values are allowed for the field. Most often used for list field types.

from  FormField
mixed Since: 3.2
$repeat

Allows extensions to create repeat elements

from  FormField
protected string Since: 1.7.0
$pattern

The pattern (Reg Ex) of value of the form field.

from  FormField
protected string Since: 4.0.0
$validationtext

The validation text of invalid value of the form field.

from  FormField
protected string Since: 1.7.0
$name

The name of the form field.

from  FormField
protected string Since: 1.7.0
$fieldname

The name of the field.

from  FormField
protected string Since: 1.7.0
$group

The group of the field.

from  FormField
protected bool Since: 1.7.0
$required

The required state for the form field. If true then there must be a value for the field to be considered valid.

from  FormField
protected bool Since: 3.2
$disabled

The disabled state for the form field. If true then the field will be disabled and user can't interact with the field.

from  FormField
protected bool Since: 3.2
$readonly

The readonly state for the form field. If true then the field will be readonly.

from  FormField
protected string Since: 1.6
$type

The form field type.

protected string Since: 1.7.0
$validate

The validation method for the form field. This value will determine which method is used to validate the value for a field.

from  FormField
protected mixed Since: 1.7.0
$value

The value of the form field.

from  FormField
protected mixed Since: 1.7.0
$default

The default value of the form field.

from  FormField
protected int Since: 3.2
$size

The size of the form field.

from  FormField
protected mixed Since: 3.2
$class

The class of the form field

from  FormField
protected mixed Since: 1.7.0
$labelclass

The label's CSS class of the form field

from  FormField
protected string Since: 3.2
$onchange

The javascript onchange of the form field.

from  FormField
protected string Since: 3.2
$onclick

The javascript onclick of the form field.

from  FormField
protected string Since: 3.7.0
$showon

The conditions to show/hide the field.

from  FormField
protected string Since: 4.0.0
$parentclass

The parent class of the field

from  FormField
static protected int Since: 1.7.0
$count

The count value for generated name field

from  FormField
static protected string Since: 1.7.0
$generated_fieldname

The string used for generated fields names

from  FormField
protected string Since: 3.6.3
$layout

Name of the layout being used to render the field

protected array Since: 5.1.0
$layoutData

Cached data for layout rendering

from  FormField
protected string $renderLayout

Layout to render the form field

from  FormField
protected string $renderLabelLayout

Layout to render the label

from  FormField
protected array Since: 4.0.0
$dataAttributes

The data-attribute name and values of the form field.

from  FormField
protected string Since: 4.2.7
$linked

The linked property

Methods

getCurrentUser()

Returns the current user, if none is set the identity of the global app is returned. This will change in 6.0 and an empty user will be returned.

void
setCurrentUser(User $currentUser)

Sets the current user.

__construct(Form $form = null)

Method to instantiate the form field object.

mixed
__get(string $name)

Method to get certain otherwise inaccessible properties from the form field object.

void
__set(string $name, mixed $value)

Method to set certain otherwise inaccessible properties of the form field object.

setForm(Form $form)

Method to attach a Form object to the field.

bool
setup(SimpleXMLElement $element, mixed $value, string $group = null)

Method to attach a Form object to the field.

void
setValue(mixed $value)

Simple method to set the value

string
getId(string $fieldId, string $fieldName)

Method to get the id used for the field input tag.

string
getInput()

Method to get the field input markup for the moduleorder field.

string
getTitle()

Method to get the field title.

string
getLabel()

Method to get the field label markup.

string
getName(string $fieldName)

Method to get the name used for the field input tag.

string
getFieldName(string $fieldName)

Method to get the field name used.

mixed
getAttribute(string $name, mixed $default = null)

Method to get an attribute of the field

array
getDataAttributes()

Method to get data attributes. For example, data-user-type

string
renderDataAttributes()

Method to render data attributes to html.

string
render(string $layoutId, array $data = [])

Render a layout of this field

string
renderField(array $options = [])

Method to get a control group with label and input.

mixed
filter(mixed $value, string $group = null, Registry|null $input = null)

Method to filter a field value.

bool|Exception
validate(mixed $value, string $group = null, Registry|null $input = null)

Method to validate a FormField object based on field data.

mixed
postProcess(mixed $value, string $group = null, Registry|null $input = null)

Method to post-process a field value.

array
getLayoutData()

Method to get the data to be passed to the layout for rendering.

array
collectLayoutData()

Method to get the data to be passed to the layout for rendering.

array
getLayoutPaths()

Allow to override renderer include paths in child fields

getRenderer(string $layoutId = 'default')

Get the renderer

bool
isDebugEnabled()

Is debug enabled for this field

Details

protected User getCurrentUser()

Since: 4.2.0

Returns the current user, if none is set the identity of the global app is returned. This will change in 6.0 and an empty user will be returned.

Return Value

User

void setCurrentUser(User $currentUser)

Since: 4.2.0

Sets the current user.

Parameters

User $currentUser

The current user object

Return Value

void

__construct(Form $form = null)

Since: 1.7.0

Method to instantiate the form field object.

Parameters

Form $form

The form to attach to the form field object.

mixed __get(string $name)

Since: 3.6.3

Method to get certain otherwise inaccessible properties from the form field object.

Parameters

string $name

The property name for which to get the value.

Return Value

mixed

The property value or null.

void __set(string $name, mixed $value)

Since: 3.6.3

Method to set certain otherwise inaccessible properties of the form field object.

Parameters

string $name

The property name for which to set the value.

mixed $value

The value of the property.

Return Value

void

FormField setForm(Form $form)

Since: 1.7.0

Method to attach a Form object to the field.

Parameters

Form $form

The Form object to attach to the form field.

Return Value

FormField

The form field object so that the method can be used in a chain.

bool setup(SimpleXMLElement $element, mixed $value, string $group = null)

Since: 3.6.3

Method to attach a Form object to the field.

Parameters

SimpleXMLElement $element

The SimpleXMLElement object representing the <field> tag for the form field object.

mixed $value

The form field value to validate.

string $group

The field name group control value. This acts as an array container for the field. For example if the field has name="foo" and the group value is set to "bar" then the full field name would end up being "bar[foo]".

Return Value

bool

True on success.

See also

FormField::setup

void setValue(mixed $value)

Since: 3.2

Simple method to set the value

Parameters

mixed $value

Value to set

Return Value

void

protected string getId(string $fieldId, string $fieldName)

Since: 1.7.0

Method to get the id used for the field input tag.

Parameters

string $fieldId

The field element id.

string $fieldName

The field element name.

Return Value

string

The id to be used for the field input tag.

protected string getInput()

Since: 1.6

Method to get the field input markup for the moduleorder field.

Return Value

string

The field input markup.

protected string getTitle()

Since: 1.7.0

Method to get the field title.

Return Value

string

The field title.

protected string getLabel()

Since: 1.7.0

Method to get the field label markup.

Return Value

string

The field label markup.

protected string getName(string $fieldName)

Since: 1.7.0

Method to get the name used for the field input tag.

Parameters

string $fieldName

The field element name.

Return Value

string

The name to be used for the field input tag.

protected string getFieldName(string $fieldName)

Since: 1.7.0

Method to get the field name used.

Parameters

string $fieldName

The field element name.

Return Value

string

The field name

mixed getAttribute(string $name, mixed $default = null)

Since: 3.2

Method to get an attribute of the field

Parameters

string $name

Name of the attribute to get

mixed $default

Optional value to return if attribute not found

Return Value

mixed

Value of the attribute / default

array getDataAttributes()

Since: 4.0.0

Method to get data attributes. For example, data-user-type

Return Value

array

list of data attribute(s)

string renderDataAttributes()

Since: 4.0.0

Method to render data attributes to html.

Return Value

string

A HTML Tag Attribute string of data attribute(s)

string render(string $layoutId, array $data = [])

Since: 3.5

Render a layout of this field

Parameters

string $layoutId

Layout identifier

array $data

Optional data for the layout

Return Value

string

string renderField(array $options = [])

Since: 3.2

Method to get a control group with label and input.

Parameters

array $options

Options to be passed into the rendering of the field

Return Value

string

A string containing the html for the control group

mixed filter(mixed $value, string $group = null, Registry|null $input = null)

Since: 4.0.0

Method to filter a field value.

Parameters

mixed $value

The optional value to use as the default for the field.

string $group

The optional dot-separated form group path on which to find the field.

Registry|null $input

An optional Registry object with the entire data set to filter against the entire form.

Return Value

mixed

The filtered value.

Exceptions

UnexpectedValueException

bool|Exception validate(mixed $value, string $group = null, Registry|null $input = null)

Since: 4.0.0

Method to validate a FormField object based on field data.

Parameters

mixed $value

The optional value to use as the default for the field.

string $group

The optional dot-separated form group path on which to find the field.

Registry|null $input

An optional Registry object with the entire data set to validate against the entire form.

Return Value

bool|Exception

Boolean true if field value is valid, Exception on failure.

Exceptions

InvalidArgumentException
UnexpectedValueException

mixed postProcess(mixed $value, string $group = null, Registry|null $input = null)

Since: 4.0.0

Method to post-process a field value.

Parameters

mixed $value

The optional value to use as the default for the field.

string $group

The optional dot-separated form group path on which to find the field.

Registry|null $input

An optional Registry object with the entire data set to filter against the entire form.

Return Value

mixed

The processed value.

protected array getLayoutData()

Since: 3.6.3

Method to get the data to be passed to the layout for rendering.

Return Value

array

protected array collectLayoutData()

Since: 5.1.0

Method to get the data to be passed to the layout for rendering.

The data is cached in memory.

Return Value

array

protected array getLayoutPaths()

Since: 3.5

Allow to override renderer include paths in child fields

Return Value

array

protected FileLayout getRenderer(string $layoutId = 'default')

Since: 3.5

Get the renderer

Parameters

string $layoutId

Id to load

Return Value

FileLayout

protected bool isDebugEnabled()

Since: 3.5

Is debug enabled for this field

Return Value

bool