JFormField/render
From Joomla! Documentation
< API16:JFormField
The "API16" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.
Template:Description:JFormField/render
Syntax[edit]
render(&$xml, $value, $formName, $groupName, $prefix)
Parameter Name | Default Value | Description |
---|---|---|
&$xml | ||
$value | ||
$formName | ||
$groupName | ||
$prefix |
Defined in[edit]
libraries/joomla/form/formfield.php
Importing[edit]
jimport( 'joomla.form.formfield' );
Source Body[edit]
public function render(&$xml, $value, $formName, $groupName, $prefix)
{
// Set the xml element object.
$this->_element = $xml;
// Set the id, name, and value.
$this->id = (string)$xml->attributes()->id;
$this->name = (string)$xml->attributes()->name;
$this->value = $value;
// Set the label and description text.
$this->labelText = (string)$xml->attributes()->label ? (string)$xml->attributes()->label : $this->name;
$this->descText = (string)$xml->attributes()->description;
// Set the required and validate options.
$this->required = ((string)$xml->attributes()->required == 'true' || (string)$xml->attributes()->required == 'required');
$this->validate = (string)$xml->attributes()->validate;
// Add the required class if the field is required.
if ($this->required)
{
if($xml->attributes()->class)
{
if (strpos((string)$xml->attributes()->class, 'required') === false) {
$xml->attributes()->class = $xml->attributes()->class.' required';
}
}
else
{
$xml->addAttribute('class', 'required');
}
}
// Set the field decorator.
$this->decorator = (string)$xml->attributes()->decorator;
// Set the visibility.
$this->hidden = ((string)$xml->attributes()->type == 'hidden' || (string)$xml->attributes()->hidden);
// Set the multiple values option.
$this->multiple = ((string)$xml->attributes()->multiple == 'true' || (string)$xml->attributes()->multiple == 'multiple');
// Set the form and group names.
$this->formName = $formName;
$this->groupName = $groupName;
// Set the prefix
$this->prefix = $prefix;
// Set the input name and id.
$this->inputName = $this->_getInputName($this->name, $formName, $groupName, $this->multiple);
$this->inputId = $this->_getInputId($this->id, $this->name, $formName, $groupName);
// Set the actual label and input.
$this->label = $this->_getLabel();
$this->input = $this->_getInput();
return $this;
}
[Edit See Also] Template:SeeAlso:JFormField/render
Examples[edit]
<CodeExamplesForm />