TbWidget
extends CBehavior
in package
Bootstrap widget behavior.
Table of Contents
Properties
- $owner : mixed
- $_api : mixed
- $_assetsUrl : mixed
- $_clientScript : mixed
Methods
- copyId() : mixed
- Copies the id to the widget HTML attributes or vise versa.
- publishAssets() : string
- Publishes an asset path.
- registerCssFile() : mixed
- Registers a CSS file.
- registerEvents() : bool
- Registers plugin events with the API.
- registerPlugin() : bool
- Registers the given plugin with the API.
- registerScriptFile() : mixed
- Registers a JavaScript file.
- resolveId() : string
- Returns the widget id and copies it to HTML attributes or vice versa.
- resolveScriptVersion() : string
- Returns the name of the correct script file to use.
- getApi() : TbApi
- Returns the API instance.
- getClientScript() : CClientScript
- Returns the client script component.
Properties
$owner
public
mixed
$owner
CWidget
$_api
private
mixed
$_api
$_assetsUrl
private
mixed
$_assetsUrl
$_clientScript
private
mixed
$_clientScript
Methods
copyId()
Copies the id to the widget HTML attributes or vise versa.
public
copyId() : mixed
Tags
publishAssets()
Publishes an asset path.
public
publishAssets(string $path[, bool $forceCopy = false ]) : string
Parameters
- $path : string
-
the assets path.
- $forceCopy : bool = false
-
whether we should copy the asset files even if they are already published before.
Tags
Return values
string —the url.
registerCssFile()
Registers a CSS file.
public
registerCssFile(string $url[, string $media = '' ]) : mixed
Parameters
- $url : string
-
URL of the CSS file.
- $media : string = ''
-
media that the CSS file should be applied to.
registerEvents()
Registers plugin events with the API.
public
registerEvents(string $selector, array<string|int, string> $events[, int $position = CClientScript::POS_END ]) : bool
Parameters
- $selector : string
-
the CSS selector.
- $events : array<string|int, string>
-
the JavaScript event configuration (name=>handler).
- $position : int = CClientScript::POS_END
-
the position of the JavaScript code.
Return values
bool —whether the events were registered.
registerPlugin()
Registers the given plugin with the API.
public
registerPlugin(string $name, string $selector[, array<string|int, mixed> $options = array() ][, int $position = CClientScript::POS_END ]) : bool
Parameters
- $name : string
-
the plugin name.
- $selector : string
-
the CSS selector.
- $options : array<string|int, mixed> = array()
-
the JavaScript options for the plugin.
- $position : int = CClientScript::POS_END
-
the position of the JavaScript code.
Return values
bool —whether the plugin was registered.
registerScriptFile()
Registers a JavaScript file.
public
registerScriptFile(string $url[, int $position = null ]) : mixed
Parameters
- $url : string
-
URL of the javascript file.
- $position : int = null
-
the position of the JavaScript code.
resolveId()
Returns the widget id and copies it to HTML attributes or vice versa.
public
resolveId([string $id = null ]) : string
Parameters
- $id : string = null
-
the widget id.
Return values
string —the widget id.
resolveScriptVersion()
Returns the name of the correct script file to use.
public
resolveScriptVersion(string $filename[, bool $minified = false ]) : string
Parameters
- $filename : string
-
the base file name.
- $minified : bool = false
-
whether to include the minified version (defaults to false).
Return values
string —the full filename.
getApi()
Returns the API instance.
protected
getApi() : TbApi
Return values
TbApi —the api.
getClientScript()
Returns the client script component.
protected
getClientScript() : CClientScript
Return values
CClientScript —the component.