PHP Class Prado\Web\UI\WebControls\TLabel

TLabel displays a piece of text on a Web page. Use {@link setText Text} property to set the text to be displayed. TLabel will render the contents enclosed within its component tag if {@link setText Text} is empty. To use TLabel as a form label, associate it with a control by setting the {@link setForControl ForControl} property. The associated control must be locatable within the label's naming container. If the associated control is not visible, the label will not be rendered, either. Note, {@link setText Text} will NOT be encoded for rendering. Make sure it does not contain dangerous characters that you want to avoid.
Since: 3.0
Author: Qiang Xue ([email protected])
Inheritance: extends TWebControl, implements Prado\IDataRenderer
Datei anzeigen Open project: pradosoft/prado Class Usage Examples

Public Methods

Method Description
getData ( ) : string Returns the text value of the label.
getForControl ( ) : string
getText ( ) : string
render ( $writer ) Renders the label.
renderContents ( $writer ) Renders the body content of the label.
setData ( $value ) Sets the text value of the label.
setForControl ( $value ) Sets the ID of the control that the label is associated with.
setText ( $value )

Protected Methods

Method Description
addAttributesToRender ( $writer ) Adds attributes to renderer.
getTagName ( ) : string

Method Details

addAttributesToRender() protected method

Adds attributes to renderer.
protected addAttributesToRender ( $writer )

getData() public method

This method is required by {@link \Prado\IDataRenderer}. It is the same as {@link getText()}.
See also: getText
Since: 3.1.0
public getData ( ) : string
return string the text value of the label

getForControl() public method

public getForControl ( ) : string
return string the associated control ID

getTagName() protected method

protected getTagName ( ) : string
return string tag name of the label, returns 'label' if there is an associated control, 'span' otherwise.

getText() public method

public getText ( ) : string
return string the text value of the label

render() public method

It overrides the parent implementation by checking if an associated control is visible or not. If not, the label will not be rendered.
public render ( $writer )

renderContents() public method

Renders the body content of the label.
public renderContents ( $writer )

setData() public method

This method is required by {@link \Prado\IDataRenderer}. It is the same as {@link setText()}.
See also: setText
Since: 3.1.0
public setData ( $value )

setForControl() public method

The control must be locatable via {@link TControl::findControl} using the ID.
public setForControl ( $value )

setText() public method

public setText ( $value )