lithium\template\helper\Form::label PHP Method

label() public method

Generates an HTML object.
public label ( string $id, string $title = null, array $options = [] ) : string
$id string The DOM ID of the field that the label is for.
$title string The content inside the `` object.
$options array Besides HTML attributes, this parameter allows one additional flag: - `'escape'` _boolean_: Defaults to `true`. Indicates whether the title of the label should be escaped. If `false`, it will be treated as raw HTML.
return string Returns a `
    public function label($id, $title = null, array $options = array())
    {
        $defaults = array('escape' => true);
        if (is_array($title)) {
            list($title, $options) = each($title);
        }
        $title = $title ?: Inflector::humanize(str_replace('.', '_', $id));
        list($name, $options, $template) = $this->_defaults(__FUNCTION__, $id, $options);
        list($scope, $options) = $this->_options($defaults, $options);
        if (strpos($id, '.')) {
            $generator = $this->_config['attributes']['id'];
            $id = $generator(__METHOD__, $id, $options);
        }
        return $this->_render(__METHOD__, $template, compact('id', 'title', 'options'), $scope);
    }