Actions

API16

JFormField/render

From Joomla! Documentation

< API16:JFormField
Revision as of 21:53, 13 May 2013 by JoomlaWikiBot (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Replacement filing cabinet.png
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.

[<! removed edit link to red link >]

<! removed transcluded page call, red link never existed >

Contents

Syntax

render(&$xml, $value, $formName, $groupName, $prefix)
Parameter Name Default Value Description
&$xml
$value
$formName
$groupName
$prefix

Defined in

libraries/joomla/form/formfield.php

Importing

jimport( 'joomla.form.formfield' );

Source Body

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;
}

[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >

Examples

<CodeExamplesForm />