lithium\template\helper\Form::label()

public method

Generates an HTML <label></label> object.

Parameters

  • string $id

    The DOM ID of the field that the label is for.

  • string $title

    The content inside the <label></label> object.

  • array $options

    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.

Returns

string

Returns a <label> tag for the name and with HTML attributes.

Source

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