Back to Joomla project (class list)

Class FormField - list of methods

Abstract Form Field class for the Joomla Platform.

Direct known subclasses

Package: Joomla\CMS\Form
Copyright: (C) 2009 Open Source Matters, Inc.
License: GNU General Public License version 2 or later; see LICENSE.txt
Located at: Joomla/Form/FormField.php
Project: Joomla

Method Summary

public
(mixed $form = null)

Method to instantiate the form field object.
Parameters
  • \Joomla\CMS\Form\Form $form The form to attach to the form field object.
Since
  • 1.7.0
Show source code of this method: __construct Source Code

public mixed
(mixed $name)

Method to get certain otherwise inaccessible properties from the form field object.
Parameters
  • string $name The property name for which to get the value.
Returns
  • mixed The property value or null.
Since
  • 1.7.0
Show source code of this method: __get Source Code

public void
(mixed $name, mixed $value)

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.
Returns
  • void
Since
  • 3.2
Show source code of this method: __set Source Code

public \Joomla\CMS\Form\FormField
(\Joomla\CMS\Form\Form $form)

Method to attach a Form object to the field.
Parameters
  • \Joomla\CMS\Form\Form $form The Form object to attach to the form field.
Returns
  • \Joomla\CMS\Form\FormField The form field object so that the method can be used in a chain.
Since
  • 1.7.0
Show source code of this method: setForm Source Code

public bool
(\SimpleXMLElement $element, mixed $value, mixed $group = null)

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 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]".
Returns
  • bool True on success.
Since
  • 1.7.0
Show source code of this method: setup Source Code

public void
(mixed $value)

Simple method to set the value
Parameters
  • mixed $value Value to set
Returns
  • void
Since
  • 3.2
Show source code of this method: setValue Source Code

protected string
(mixed $fieldId, mixed $fieldName)

Method to get the id used for the field input tag.
Parameters
  • string $fieldId The field element id.
  • string $fieldName The field element name.
Returns
  • string The id to be used for the field input tag.
Since
  • 1.7.0
Show source code of this method: getId Source Code

protected string
()

Method to get the field input markup.
Returns
  • string The field input markup.
Since
  • 1.7.0
Show source code of this method: getInput Source Code

protected string
()

Method to get the field title.
Returns
  • string The field title.
Since
  • 1.7.0
Show source code of this method: getTitle Source Code

protected string
()

Method to get the field label markup.
Returns
  • string The field label markup.
Since
  • 1.7.0
Show source code of this method: getLabel Source Code

protected string
(mixed $fieldName)

Method to get the name used for the field input tag.
Parameters
  • string $fieldName The field element name.
Returns
  • string The name to be used for the field input tag.
Since
  • 1.7.0
Show source code of this method: getName Source Code

protected string
(mixed $fieldName)

Method to get the field name used.
Parameters
  • string $fieldName The field element name.
Returns
  • string The field name
Since
  • 1.7.0
Show source code of this method: getFieldName Source Code

public mixed
(mixed $name, mixed $default = null)

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
Returns
  • mixed Value of the attribute / default
Since
  • 3.2
Show source code of this method: getAttribute Source Code

public array
()

Method to get data attributes. For example, data-user-type
Returns
  • array list of data attribute(s)
Since
  • 4.0.0
Show source code of this method: getDataAttributes Source Code

public string
()

Method to render data attributes to html.
Returns
  • string A HTML Tag Attribute string of data attribute(s)
Since
  • 4.0.0
Show source code of this method: renderDataAttributes Source Code

public string
(mixed $layoutId, mixed $data = array())

Render a layout of this field
Parameters
  • string $layoutId Layout identifier
  • array $data Optional data for the layout
Returns
  • string
Since
  • 3.5
Show source code of this method: render Source Code

public string
(mixed $options = array())

Method to get a control group with label and input.
Parameters
  • array $options Options to be passed into the rendering of the field
Returns
  • string A string containing the html for the control group
Since
  • 3.2
Show source code of this method: renderField Source Code

public mixed
(mixed $value, mixed $group = null, \Joomla\Registry\Registry $input = null)

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.
  • \Joomla\Registry\Registry $input An optional Registry object with the entire data set to filter against the entire form.
Returns
  • mixed The filtered value.
Since
  • 4.0.0
-
  • \UnexpectedValueException
Show source code of this method: filter Source Code

public bool|\Exception
(mixed $value, mixed $group = null, \Joomla\Registry\Registry $input = null)

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.
  • \Joomla\Registry\Registry $input An optional Registry object with the entire data set to validate against the entire form.
Returns
  • bool|\Exception Boolean true if field value is valid, Exception on failure.
Since
  • 4.0.0
-
  • \InvalidArgumentException
  • \UnexpectedValueException
Show source code of this method: validate Source Code

public mixed
(mixed $value, mixed $group = null, \Joomla\Registry\Registry $input = null)

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.
  • \Joomla\Registry\Registry $input An optional Registry object with the entire data set to filter against the entire form.
Returns
  • mixed The processed value.
Since
  • 4.0.0
Show source code of this method: postProcess Source Code

protected array
()

Method to get the data to be passed to the layout for rendering.
Returns
  • array
Since
  • 3.5
Show source code of this method: getLayoutData Source Code

protected array
()

Allow to override renderer include paths in child fields
Returns
  • array
Since
  • 3.5
Show source code of this method: getLayoutPaths Source Code

protected \Joomla\CMS\Layout\FileLayout
(mixed $layoutId = 'default')

Get the renderer
Parameters
  • string $layoutId Id to load
Returns
  • \Joomla\CMS\Layout\FileLayout
Since
  • 3.5
Show source code of this method: getRenderer Source Code

protected bool
()

Is debug enabled for this field
Returns
  • bool
Since
  • 3.5
Show source code of this method: isDebugEnabled Source Code

Properties Summary

protected string
$description
The description text for the form field. Usually used in tooltips.
Since
  • 1.7.0
protected string
$hint
The hint text for the form field used to display hint inside the field.
Since
  • 3.2
protected mixed
$autocomplete
The autocomplete state for the form field. If 'off' element will not be automatically completed by browser.
Since
  • 3.2
protected bool
$spellcheck
The spellcheck state for the form field.
Since
  • 3.2
protected bool
$autofocus
The autofocus request for the form field. If true element will be automatically focused on document load.
Since
  • 3.2
protected \SimpleXMLElement
$element
The SimpleXMLElement object of the `` XML element that describes the form field.
Since
  • 1.7.0
protected \Joomla\CMS\Form\Form
$form
The Form object of the form attached to the form field.
Since
  • 1.7.0
protected string
$formControl
The form control prefix for field names from the Form object attached to the form field.
Since
  • 1.7.0
protected bool
$hidden
The hidden state for the form field.
Since
  • 1.7.0
protected bool
$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.
Since
  • 4.0.0
protected bool
$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.
Since
  • 4.0.0
protected bool
$inlineHelp
Should the description be hidden/shown with toggle button when rendering the form field?
Since
  • 4.1.4
protected bool
$translateLabel
True to translate the field label string.
Since
  • 1.7.0
protected bool
$translateDescription
True to translate the field description string.
Since
  • 1.7.0
protected bool
$translateHint
True to translate the field hint string.
Since
  • 3.2
protected string
$id
The document id for the form field.
Since
  • 1.7.0
protected string
$input
The input for the form field.
Since
  • 1.7.0
protected string
$label
The label for the form field.
Since
  • 1.7.0
protected bool
$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.
Since
  • 1.7.0
public mixed
$repeat
Allows extensions to create repeat elements
Since
  • 3.2
protected string
$pattern
The pattern (Reg Ex) of value of the form field.
Since
  • 1.7.0
protected string
$validationtext
The validation text of invalid value of the form field.
Since
  • 4.0.0
protected string
$name
The name of the form field.
Since
  • 1.7.0
protected string
$fieldname
The name of the field.
Since
  • 1.7.0
protected string
$group
The group of the field.
Since
  • 1.7.0
protected bool
$required
The required state for the form field. If true then there must be a value for the field to be considered valid.
Since
  • 1.7.0
protected bool
$disabled
The disabled state for the form field. If true then the field will be disabled and user can't interact with the field.
Since
  • 3.2
protected bool
$readonly
The readonly state for the form field. If true then the field will be readonly.
Since
  • 3.2
protected string
$type
The form field type.
Since
  • 1.7.0
protected string
$validate
The validation method for the form field. This value will determine which method is used to validate the value for a field.
Since
  • 1.7.0
protected mixed
$value
The value of the form field.
Since
  • 1.7.0
protected mixed
$default
The default value of the form field.
Since
  • 1.7.0
protected int
$size
The size of the form field.
Since
  • 3.2
protected mixed
$class
The class of the form field
Since
  • 3.2
protected mixed
$labelclass
The label's CSS class of the form field
Since
  • 1.7.0
protected string
$onchange
The javascript onchange of the form field.
Since
  • 3.2
protected string
$onclick
The javascript onclick of the form field.
Since
  • 3.2
protected string
$showon
The conditions to show/hide the field.
Since
  • 3.7.0
protected string
$parentclass
The parent class of the field
Since
  • 4.0.0
protected static int
$count
The count value for generated name field
Since
  • 1.7.0
protected static string
$generated_fieldname
The string used for generated fields names
Since
  • 1.7.0
protected string
$layout
Name of the layout being used to render the field
Since
  • 3.5
protected string
$renderLayout
Layout to render the form field
protected string
$renderLabelLayout
Layout to render the label
protected array
$dataAttributes
The data-attribute name and values of the form field.
Since
  • 4.0.0

Tags Summary

Since
1.7.0