Class \Prado\Web\UI\WebControls\TTextHighlighter
TTextHighlighter does syntax highlighting its body content, including static text and rendering results of child controls. You can set \Prado\Web\UI\WebControls\setLanguage to specify what kind of syntax the body content is and \Prado\Web\UI\WebControls\setSyntaxStyle to specify the style used to highlight the content.
The list of supported syntaxes is available at https://github.com/isagalaev/highlight.js/tree/master/src/languages The list of supported styles is available at https://github.com/isagalaev/highlight.js/tree/master/src/styles
By setting \Prado\Web\UI\WebControls\setShowLineNumbers to true, the highlighted result may be shown with line numbers. To style lin numbers, use the css class "hljs-line-numbers".
By default the contents are encoded using THttpUtility::htmlEncode before being rendered, and any leading end-of-line character is removed to avoid an empty line being rendered. Setting \Prado\Web\UI\WebControls\setEncodeHtml to false the original content will be rendered.
Note, TTextHighlighter requires THead to be placed on the page template because it needs to insert some CSS styles.
Class hierarchy
- \Prado\Web\UI\WebControls\TTextHighlighter
- \Prado\Web\UI\WebControls\TTextProcessor
- \Prado\Web\UI\WebControls\TWebControl implements IStyleable
- \Prado\Web\UI\TControl implements IRenderable, IBindable
- \Prado\TApplicationComponent
- \Prado\TComponent
Since: 3.0
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
onPreRender(TEventParameter $param) : mixed
Registers css style for the highlighted result.
This method overrides parent implementation. |
public
|
processText(string $text) : string
Processes a text string.
This method must be implemented by child classes. |
public
|
renderBeginTag(THtmlWriter $writer) : mixed
Renders the openning tag for the control (including attributes)
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
protected
|
|
protected
|
|
protected
|
|
protected
|