PHP Class Prado\Web\UI\WebControls\TWebControlDecorator

A TWebControlDecorator can be applied to a {@link TWebControl} to customize its rendering. TWebControlDecorator can add custom html code before and after both the open and close tag of a {@link TWebControl}. The html code can be an user-defined text or an external template file that will be instantiated and rendered in place. This is an easy way to have your look and feel depend upon the theme instead of writing specific html in your templates to achieve your website desires. Here is an example of how to code your theme skin:
The order of the inclusion of the decoration into the page goes like this: * PreTagTemplate * PreTagText * TWebControl Open Tag Rendered * PreContentsText * PreContentsTemplate * TWebControl Children Rendered * PostContentsTemplate * PostContentsText * TWebControl CloseTag Rendered * PostTagText * PostTagTemplate
Since: 3.2
Author: Brad Anderson ([email protected])
Inheritance: extends Prado\TComponent
Show file Open project: pradosoft/prado

Public Methods

Method Description
__construct ( $control, $onlyinternal = false ) Constructor.
ensureTemplateDecoration ( $sender = null, $param = null ) : boolean This method places the templates around the open and close tag. This takes a parameter which is to specify the control to get the outer template decoration. If no outer control is specified
getPostContentsTemplate ( ) : TTemplate | null
getPostContentsText ( ) : string
getPostTagTemplate ( ) : TTemplate | null
getPostTagText ( ) : string
getPreContentsTemplate ( ) : TTemplate | null
getPreContentsText ( ) : string
getPreTagTemplate ( ) : TTemplate | null
getPreTagText ( ) : string
getUseState ( ) : boolean
instantiate ( $outercontrol = null ) this is a framework call. The Text decoration can't influence the object hierarchy because they are rendered into into the writer directly.
renderPostContentsText ( $writer ) This method places the post contents text into the {@link TTextWriter}
renderPostTagText ( $writer ) This method places the post tag text into the {@link TTextWriter}
renderPreContentsText ( $writer ) This method places the pre contents text into the {@link TTextWriter}
renderPreTagText ( $writer ) This method places the pre tag text into the {@link TTextWriter}
setPostContentsTemplate ( $value )
setPostContentsText ( $value )
setPostTagTemplate ( $value )
setPostTagText ( $value )
setPreContentsTemplate ( $value )
setPreContentsText ( $value )
setPreTagTemplate ( $value )
setPreTagText ( $value )
setUseState ( boolean $value )

Method Details

__construct() public method

Initializes the control .
public __construct ( $control, $onlyinternal = false )

ensureTemplateDecoration() public method

This method places the templates around the open and close tag. This takes a parameter which is to specify the control to get the outer template decoration. If no outer control is specified
public ensureTemplateDecoration ( $sender = null, $param = null ) : boolean
return boolean returns true if the template decorations have been added

getPostContentsTemplate() public method

public getPostContentsTemplate ( ) : TTemplate | null
return TTemplate | null the template before the close tag in the TWebControl. Defaults to null.

getPostContentsText() public method

public getPostContentsText ( ) : string
return string the text before the close tag in the TWebControl

getPostTagTemplate() public method

public getPostTagTemplate ( ) : TTemplate | null
return TTemplate | null the template after the close tag in the TWebControl. Defaults to null.

getPostTagText() public method

public getPostTagText ( ) : string
return string the text before the close tag in the TWebControl

getPreContentsTemplate() public method

public getPreContentsTemplate ( ) : TTemplate | null
return TTemplate | null the template after the open tag in the TWebControl. Defaults to null.

getPreContentsText() public method

public getPreContentsText ( ) : string
return string the text after the open tag in the TWebControl

getPreTagTemplate() public method

public getPreTagTemplate ( ) : TTemplate | null
return TTemplate | null the template before the open tag in the TWebControl. Defaults to null.

getPreTagText() public method

public getPreTagText ( ) : string
return string gets the text before the open tag in the TWebControl

getUseState() public method

public getUseState ( ) : boolean
return boolean if the templates in this decoration need state. This defaults to false

instantiate() public method

This call attaches the ensureTemplateDecoration to the TPage onSaveStateComplete so these controls don't have page states. This is as close to not influencing the page as possible.
public instantiate ( $outercontrol = null )

renderPostContentsText() public method

This method places the post contents text into the {@link TTextWriter}
public renderPostContentsText ( $writer )

renderPostTagText() public method

This method places the post tag text into the {@link TTextWriter}
public renderPostTagText ( $writer )

renderPreContentsText() public method

This method places the pre contents text into the {@link TTextWriter}
public renderPreContentsText ( $writer )

renderPreTagText() public method

This method places the pre tag text into the {@link TTextWriter}
public renderPreTagText ( $writer )

setPostContentsTemplate() public method

public setPostContentsTemplate ( $value )

setPostContentsText() public method

public setPostContentsText ( $value )

setPostTagTemplate() public method

public setPostTagTemplate ( $value )

setPostTagText() public method

public setPostTagText ( $value )

setPreContentsTemplate() public method

public setPreContentsTemplate ( $value )

setPreContentsText() public method

public setPreContentsText ( $value )

setPreTagTemplate() public method

public setPreTagTemplate ( $value )

setPreTagText() public method

public setPreTagText ( $value )

setUseState() public method

public setUseState ( boolean $value )
$value boolean true to tell the decoration that the templates need state and should be placed in a control step before the state is saved.