Back to Form class

Method getLabel

public string
getLabel
(mixed $name, mixed $group = null)
Method to get the label for a field input.
Parameters
  • string $name The name of the form field.
  • string $group The optional dot-separated form group path on which to find the field.
Returns
  • string The form field label.
Since
  • 1.7.0
Class: Form
Project: Joomla

Method getLabel - Source code

/**
 * Method to get the label for a field input.
 *
 * @param   string  $name   The name of the form field.
 * @param   string  $group  The optional dot-separated form group path on which to find the field.
 *
 * @return  string  The form field label.
 *
 * @since   1.7.0
 */
public function getLabel($name, $group = null)
{
    // Attempt to get the form field.
    if ($field = $this->getField($name, $group)) {
        return $field->label;
    }
    return '';
}