Joomla CMS
4.2.2
Documentation des API du CMS Joomla en version 4.2.2
|
Fonctions membres publiques | |
__construct ($name, array $options=[]) | |
bind ($data) | |
getErrors () | |
getField ($name, $group=null, $value=null) | |
getFieldAttribute ($name, $attribute, $default=null, $group=null) | |
getFieldset ($set=null) | |
getFieldsets ($group=null) | |
getFormControl () | |
getGroup ($group, $nested=false) | |
getInput ($name, $group=null, $value=null) | |
getLabel ($name, $group=null) | |
getName () | |
getValue ($name, $group=null, $default=null) | |
renderField ($name, $group=null, $default=null, $options=[]) | |
renderFieldset ($name, $options=[]) | |
load ($data, $replace=true, $xpath=null) | |
loadFile ($file, $reset=true, $xpath=null) | |
removeField ($name, $group=null) | |
removeGroup ($group) | |
reset ($xml=false) | |
setField (\SimpleXMLElement $element, $group=null, $replace=true, $fieldset='default') | |
setFieldAttribute ($name, $attribute, $value, $group=null) | |
setFields (&$elements, $group=null, $replace=true, $fieldset='default') | |
setValue ($name, $group=null, $value=null) | |
process ($data, $group=null) | |
filter ($data, $group=null) | |
validate ($data, $group=null) | |
postProcess ($data, $group=null) | |
getAttribute ($name, $default=null) | |
getData () | |
getXml () | |
getFieldXml ($name, $group=null) | |
Fonctions membres publiques statiques | |
static | addFieldPath ($new=null) |
static | addFormPath ($new=null) |
static | addRulePath ($new=null) |
static | addFilterPath ($new=null) |
static | getInstance ($name, $data=null, $options=[], $replace=true, $xpath=false) |
Champs de données | |
$repeat = false | |
Fonctions membres protégées | |
bindLevel ($group, $data) | |
findField ($name, $group=null) | |
& | findFieldsByFieldset ($name) |
& | findFieldsByGroup ($group=null, $nested=false) |
& | findGroup ($group) |
loadField ($element, $group=null, $value=null) | |
syncPaths () | |
Fonctions membres protégées statiques | |
static | addNode (\SimpleXMLElement $source, \SimpleXMLElement $new) |
static | mergeNode (\SimpleXMLElement $source, \SimpleXMLElement $new) |
static | mergeNodes (\SimpleXMLElement $source, \SimpleXMLElement $new) |
Attributs protégés | |
$data | |
$errors = [] | |
$name | |
$options = [] | |
$xml | |
Attributs protégés statiques | |
static | $forms = [] |
Form Class for the Joomla Platform.
This class implements a robust API for constructing, populating, filtering, and validating forms. It uses XML definitions to construct form fields and a variety of field and rule classes to render and validate the form.
__construct | ( | $name, | |
array | $options = [] |
||
) |
|
static |
Proxy for FormHelper::addFieldPath().
mixed | $new | A path or array of paths to add. |
Références FormHelper\addFieldPath().
Référencé par PluginModel\getForm(), TaskModel\getForm(), ContactModel\getForm(), StyleModel\getForm(), UpdateModel\getForm(), ModuleModel\getForm(), LanguagesModel\getForm(), Joomla\CMS\MVC\Model\loadForm(), et Joomla\CMS\MVC\Model\workflowAfterSave().
|
static |
Proxy for FormHelper::addFilterPath().
mixed | $new | A path or array of paths to add. |
Références FormHelper\addFilterPath().
|
static |
Proxy for FormHelper::addFormPath().
mixed | $new | A path or array of paths to add. |
Références FormHelper\addFormPath().
Référencé par ContactModel\buildContactExtendedData(), ComponentModel\getForm(), SetupModel\getForm(), ChecksModel\getForm(), UpdateModel\getForm(), LanguagesModel\getForm(), Joomla\CMS\MVC\Model\loadForm(), FormModel\loadForm(), ModulesModel\preprocessForm(), ModuleModel\preprocessForm(), StyleController\save(), ModuleController\save(), et Joomla\CMS\MVC\Model\workflowAfterSave().
|
staticprotected |
|
static |
Proxy for FormHelper::addRulePath().
mixed | $new | A path or array of paths to add. |
Références FormHelper\addRulePath().
Référencé par LanguagesModel\getForm().
bind | ( | $data | ) |
Method to bind data to the form.
mixed | $data | An array or object of data to bind to the form. |
Références $data, $this, et null.
Référencé par SubformField\loadSubFormData().
|
protected |
Method to bind data to the form for the group level.
string | $group | The dot-separated form group path on which to bind the data. |
mixed | $data | An array or object of data to bind to the form for the group level. |
Références $data, elseif, et ArrayHelper\isAssociative().
filter | ( | $data, | |
$group = null |
|||
) |
|
protected |
Method to get a form field represented as an XML element object.
string | $name | The name of the form field. |
string | $group | The optional dot-separated form group path on which to find the field. |
|
protected |
Method to get an array of <field>
elements from the form XML document which are in a control group by name.
mixed | $group | The optional dot-separated form group path on which to find the fields. Null will return all fields. False will return fields not in a group. |
boolean | $nested | True to also include fields in nested groups that are inside of the group for which to find fields. |
|
protected |
Method to get a form field group represented as an XML element object.
string | $group | The dot-separated form group path on which to find the group. |
Références $fields, $groups, $i, $n, $names, $this, et $tmp.
getAttribute | ( | $name, | |
$default = null |
|||
) |
getData | ( | ) |
getErrors | ( | ) |
Return all errors, if any.
Method to get a form field represented as a FormField object.
string | $name | The name of the form field. |
string | $group | The optional dot-separated form group path on which to find the field. |
mixed | $value | The optional value to use as the default for the field. |
Method to get an attribute value from a field XML element. If the attribute doesn't exist or is null then the optional default value will be used.
string | $name | The name of the form field for which to get the attribute value. |
string | $attribute | The name of the attribute for which to get a value. |
mixed | $default | The optional default value to use if no attribute value exists. |
string | $group | The optional dot-separated form group path on which to find the field. |
getFieldset | ( | $set = null | ) |
getFieldsets | ( | $group = null | ) |
Method to get an array of fieldset objects optionally filtered over a given field group.
string | $group | The dot-separated form group path on which to filter the fieldsets. |
Références $fieldsets, $name, $this, $tmp, et $value.
getFieldXml | ( | $name, | |
$group = null |
|||
) |
Method to get a form field represented as an XML element object.
string | $name | The name of the form field. |
string | $group | The optional dot-separated form group path on which to find the field. |
Références $name.
getFormControl | ( | ) |
Method to get the form control. This string serves as a container for all form fields. For example, if there is a field named 'foo' and a field named 'bar' and the form control is empty the fields will be rendered like: <input name="foo" />
and <input name="bar" />
. If the form control is set to 'joomla' however, the fields would be rendered like: <input name="joomla[foo]" />
and <input name="joomla[bar]" />
.
getGroup | ( | $group, | |
$nested = false |
|||
) |
Method to get an array of FormField objects in a given field group by name.
string | $group | The dot-separated form group path for which to get the form fields. |
boolean | $nested | True to also include fields in nested groups that are inside of the group for which to find fields. |
Method to get a form field markup for the field input.
string | $name | The name of the form field. |
string | $group | The optional dot-separated form group path on which to find the field. |
mixed | $value | The optional value to use as the default for the field. |
Method to get an instance of a form.
string | $name | The name of the form. |
string | $data | The name of an XML file or string to load as the form definition. |
array | $options | An array of form options. |
boolean | $replace | Flag to toggle whether form fields should be replaced if a field already exists with the same group/name. |
string | boolean | $xpath | An optional xpath to search for the fields. |
Références $data, $name, $options, class, et Factory\getContainer().
Référencé par ContactModel\buildContactExtendedData(), SetupModel\getForm(), ChecksModel\getForm(), UpdateModel\getForm(), LanguagesModel\getForm(), TinymcebuilderField\getLayoutData(), FormModel\loadForm(), SubformField\loadSubForm(), et SubformField\loadSubFormData().
getLabel | ( | $name, | |
$group = null |
|||
) |
getName | ( | ) |
Method to get the form name.
Références $name.
Référencé par SubformField\loadSubFormData().
Method to get the value of a field.
string | $name | The name of the field for which to get the value. |
string | $group | The optional dot-separated form group path on which to get the value. |
mixed | $default | The optional default value of the field value is empty. |
getXml | ( | ) |
Method to load the form description from an XML string or object.
The replace option works per field. If a field being loaded already exists in the current form definition then the behavior or load will vary depending upon the replace flag. If it is set to true, then the existing field will be replaced in its exact location by the new field being loaded. If it is false, then the new field being loaded will be ignored and the method will move on to the next field to load.
string | $data | The name of an XML string or object. |
boolean | $replace | Flag to toggle whether form fields should be replaced if a field already exists with the same group/name. |
string | $xpath | An optional xpath to search for the fields. |
Method to load, setup and return a FormField object based on field data.
string | $element | The XML element object representation of the form field. |
string | $group | The optional dot-separated form group path on which to find the field. |
mixed | $value | The optional value to use as the default for the field. |
Références $default, $field, $lang, $this, $type, $value, Text\_(), class, Factory\getContainer(), Joomla\Database\getDatabase(), Factory\getLanguage(), FormHelper\loadFieldType(), et null.
Method to load the form description from an XML file.
The reset option works on a group basis. If the XML file references groups that have already been created they will be replaced with the fields in the new XML file unless the $reset parameter has been set to false.
string | $file | The filesystem path of an XML file. |
boolean | $reset | Flag to toggle whether form fields should be replaced if a field already exists with the same group/name. |
string | $xpath | An optional xpath to search for the fields. |
Références $xml, et Path\find().
Référencé par StyleModel\preprocessForm(), et CategoryModel\preprocessForm().
|
staticprotected |
|
staticprotected |
postProcess | ( | $data, | |
$group = null |
|||
) |
Method to post-process form data.
array | $data | An array of field values to post-process. |
string | $group | The optional dot-separated form group path on which to filter the fields to be validated. |
Références $data, $field, $fields, $groups, $input, $key, $name, $output, et $this.
process | ( | $data, | |
$group = null |
|||
) |
Method to process the form data.
array | $data | An array of field values to filter. |
string | $group | The dot-separated form group path on which to filter the fields. |
Références $data.
removeField | ( | $name, | |
$group = null |
|||
) |
Method to remove a field from the form definition.
string | $name | The name of the form field for which remove. |
string | $group | The optional dot-separated form group path on which to find the field. |
removeGroup | ( | $group | ) |
Method to remove a group from the form definition.
string | $group | The dot-separated form group path for the group to remove. |
Références $this.
Method to get a control group with label and input.
string | $name | The name of the field for which to get the value. |
string | $group | The optional dot-separated form group path on which to get the value. |
mixed | $default | The optional default value of the field value is empty. |
array | $options | Any options to be passed into the rendering of the field |
renderFieldset | ( | $name, | |
$options = [] |
|||
) |
Method to get all control groups with label and input of a fieldset.
string | $name | The name of the fieldset for which to get the values. |
array | $options | Any options to be passed into the rendering of the field |
reset | ( | $xml = false | ) |
Method to reset the form data store and optionally the form XML definition.
boolean | $xml | True to also reset the XML form definition. |
Références $xml.
Method to set a field XML element to the form definition. If the replace flag is set then the field will be set whether it already exists or not. If it isn't set, then the field will not be replaced if it already exists.
\SimpleXMLElement | $element | The XML element object representation of the form field. |
string | $group | The optional dot-separated form group path on which to set the field. |
boolean | $replace | True to replace an existing field if one already exists. |
string | $fieldset | The name of the fieldset we are adding the field to. |
setFieldAttribute | ( | $name, | |
$attribute, | |||
$value, | |||
$group = null |
|||
) |
Method to set an attribute value for a field XML element.
string | $name | The name of the form field for which to set the attribute value. |
string | $attribute | The name of the attribute for which to set a value. |
mixed | $value | The value to set for the attribute. |
string | $group | The optional dot-separated form group path on which to find the field. |
Références $name, $this, et $value.
Référencé par FormModel\preprocessForm(), et ItemsModel\preprocessForm().
Method to set some field XML elements to the form definition. If the replace flag is set then the fields will be set whether they already exists or not. If it isn't set, then the fields will not be replaced if they already exist.
array | &$elements | The array of XML element object representations of the form fields. |
string | $group | The optional dot-separated form group path on which to set the fields. |
boolean | $replace | True to replace existing fields if they already exist. |
string | $fieldset | The name of the fieldset we are adding the field to. |
Method to set the value of a field. If the field does not exist in the form then the method will return false.
string | $name | The name of the field for which to set the value. |
string | $group | The optional dot-separated form group path on which to find the field. |
mixed | $value | The value to set for the field. |
|
protected |
Method to synchronize any field, form or rule paths contained in the XML document.
Références $path, $prefix, $this, FormHelper\addFieldPrefix(), FormHelper\addFilterPrefix(), FormHelper\addFormPrefix(), FormHelper\addRulePrefix(), et JPATH_ROOT.
validate | ( | $data, | |
$group = null |
|||
) |
Method to validate form data.
Validation warnings will be pushed into JForm::errors and should be retrieved with JForm::getErrors() when validate returns boolean false.
array | $data | An array of field values to validate. |
string | $group | The optional dot-separated form group path on which to filter the fields to be validated. |
Références $data, $disabled, $field, $fields, $groups, $input, $key, $name, $return, $this, Text\_(), elseif, et Text\sprintf().
|
protected |
|
protected |
|
staticprotected |
|
protected |
|
protected |
$repeat = false |
|
protected |