Back to Form class

Method renderField

public string
renderField
(mixed $name, mixed $group = null, mixed $default = null, mixed $options = [])
Method to get a control group with label and input.
Parameters
  • 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
Returns
  • string A string containing the html for the control goup
Since
  • 3.2.3
Class: Form
Project: Joomla

Method renderField - Source code

/**
 * Method to get a control group with label and input.
 *
 * @param   string  $name     The name of the field for which to get the value.
 * @param   string  $group    The optional dot-separated form group path on which to get the value.
 * @param   mixed   $default  The optional default value of the field value is empty.
 * @param   array   $options  Any options to be passed into the rendering of the field
 *
 * @return  string  A string containing the html for the control goup
 *
 * @since   3.2.3
 */
public function renderField($name, $group = null, $default = null, $options = [])
{
    $field = $this->getField($name, $group, $default);
    if ($field) {
        return $field->renderField($options);
    }
    return '';
}