\DebugBarJavascriptRenderer

Renders the debug bar using the client side javascript implementation

Generates all the needed initialization code of controls

Summary

Methods
Properties
Constants
__construct()
setOptions()
setBasePath()
getBasePath()
setBaseUrl()
getBaseUrl()
setIncludeVendors()
areVendorsIncluded()
disableVendor()
setJavascriptClass()
getJavascriptClass()
setVariableName()
getVariableName()
setInitialization()
getInitialization()
setEnableJqueryNoConflict()
isJqueryNoConflictEnabled()
setUseRequireJs()
isRequireJsUsed()
addControl()
disableControl()
getControls()
ignoreCollector()
getIgnoredCollectors()
setAjaxHandlerClass()
getAjaxHandlerClass()
setBindAjaxHandlerToJquery()
isAjaxHandlerBoundToJquery()
setBindAjaxHandlerToXHR()
isAjaxHandlerBoundToXHR()
setOpenHandlerClass()
getOpenHandlerClass()
setOpenHandlerUrl()
getOpenHandlerUrl()
addAssets()
getAssets()
getAsseticCollection()
dumpCssAssets()
dumpJsAssets()
renderHead()
renderOnShutdown()
renderOnShutdownWithHead()
replaceTagInBuffer()
render()
No public properties found
INITIALIZE_CONSTRUCTOR
INITIALIZE_CONTROLS
REPLACEABLE_TAG
RELATIVE_PATH
RELATIVE_URL
getRelativeRoot()
makeUriRelativeTo()
filterAssetArray()
createAsseticCollection()
dumpAssets()
getJsInitializationCode()
getJsControlsDefinitionCode()
getAddDatasetCode()
$debugBar
$baseUrl
$basePath
$cssVendors
$jsVendors
$includeVendors
$cssFiles
$jsFiles
$additionalAssets
$javascriptClass
$variableName
$enableJqueryNoConflict
$useRequireJs
$initialization
$controls
$ignoredCollectors
$ajaxHandlerClass
$ajaxHandlerBindToJquery
$ajaxHandlerBindToXHR
$openHandlerClass
$openHandlerUrl
N/A
No private methods found
No private properties found
N/A

Constants

INITIALIZE_CONSTRUCTOR

INITIALIZE_CONSTRUCTOR

INITIALIZE_CONTROLS

INITIALIZE_CONTROLS

REPLACEABLE_TAG

REPLACEABLE_TAG

RELATIVE_PATH

RELATIVE_PATH

RELATIVE_URL

RELATIVE_URL

Properties

$debugBar

$debugBar : 

Type

$baseUrl

$baseUrl : 

Type

$basePath

$basePath : 

Type

$cssVendors

$cssVendors : 

Type

$jsVendors

$jsVendors : 

Type

$includeVendors

$includeVendors : 

Type

$cssFiles

$cssFiles : 

Type

$jsFiles

$jsFiles : 

Type

$additionalAssets

$additionalAssets : 

Type

$javascriptClass

$javascriptClass : 

Type

$variableName

$variableName : 

Type

$enableJqueryNoConflict

$enableJqueryNoConflict : 

Type

$useRequireJs

$useRequireJs : 

Type

$initialization

$initialization : 

Type

$controls

$controls : 

Type

$ignoredCollectors

$ignoredCollectors : 

Type

$ajaxHandlerClass

$ajaxHandlerClass : 

Type

$ajaxHandlerBindToJquery

$ajaxHandlerBindToJquery : 

Type

$ajaxHandlerBindToXHR

$ajaxHandlerBindToXHR : 

Type

$openHandlerClass

$openHandlerClass : 

Type

$openHandlerUrl

$openHandlerUrl : 

Type

Methods

__construct()

__construct(\DebugBar\DebugBar  $debugBar, string  $baseUrl = null, string  $basePath = null) 

Parameters

\DebugBar\DebugBar $debugBar
string $baseUrl
string $basePath

setOptions()

setOptions(array  $options) 

Sets options from an array

Options:

  • base_path
  • base_url
  • include_vendors
  • javascript_class
  • variable_name
  • initialization
  • enable_jquery_noconflict
  • controls
  • disable_controls
  • ignore_collectors
  • ajax_handler_classname
  • ajax_handler_bind_to_jquery
  • open_handler_classname
  • open_handler_url

Parameters

array $options

[description]

setBasePath()

setBasePath(string  $path) 

Sets the path which assets are relative to

Parameters

string $path

getBasePath()

getBasePath() : string

Returns the path which assets are relative to

Returns

string

setBaseUrl()

setBaseUrl(string  $url) 

Sets the base URL from which assets will be served

Parameters

string $url

getBaseUrl()

getBaseUrl() : string

Returns the base URL from which assets will be served

Returns

string

setIncludeVendors()

setIncludeVendors(boolean  $enabled = true) 

Whether to include vendor assets

You can only include js or css vendors using setIncludeVendors('css') or setIncludeVendors('js')

Parameters

boolean $enabled

areVendorsIncluded()

areVendorsIncluded() : boolean

Checks if vendors assets are included

Returns

boolean

disableVendor()

disableVendor(string  $name) : void

Disable a specific vendor's assets.

Parameters

string $name

"jquery", "fontawesome", "highlightjs"

setJavascriptClass()

setJavascriptClass(string  $className) 

Sets the javascript class name

Parameters

string $className

getJavascriptClass()

getJavascriptClass() : string

Returns the javascript class name

Returns

string

setVariableName()

setVariableName(string  $name) 

Sets the variable name of the class instance

Parameters

string $name

getVariableName()

getVariableName() : string

Returns the variable name of the class instance

Returns

string

setInitialization()

setInitialization(integer  $init) 

Sets what should be initialized

  • INITIALIZE_CONSTRUCTOR: only initializes the instance
    • INITIALIZE_CONTROLS: initializes the controls and data mapping
    • INITIALIZE_CONSTRUCTOR | INITIALIZE_CONTROLS: initialize everything (default)

Parameters

integer $init

getInitialization()

getInitialization() : integer

Returns what should be initialized

Returns

integer

setEnableJqueryNoConflict()

setEnableJqueryNoConflict(boolean  $enabled = true) 

Sets whether to call jQuery.noConflict()

Parameters

boolean $enabled

isJqueryNoConflictEnabled()

isJqueryNoConflictEnabled() : boolean

Checks if jQuery.noConflict() will be called

Returns

boolean

setUseRequireJs()

setUseRequireJs(boolean  $enabled = true) : $this

Sets whether to use RequireJS or not

Parameters

boolean $enabled

Returns

$this

isRequireJsUsed()

isRequireJsUsed() : boolean

Checks if RequireJS is used

Returns

boolean

addControl()

addControl(string  $name, array  $options) 

Adds a control to initialize

Possible options:

  • icon: icon name
  • tooltip: string
  • widget: widget class name
  • title: tab title
  • map: a property name from the data to map the control to
  • default: a js string, default value of the data map

"icon" or "widget" are at least needed

Parameters

string $name
array $options

disableControl()

disableControl(string  $name) 

Disables a control

Parameters

string $name

getControls()

getControls() : array

Returns the list of controls

This does not include controls provided by collectors

Returns

array

ignoreCollector()

ignoreCollector(string  $name) 

Ignores widgets provided by a collector

Parameters

string $name

getIgnoredCollectors()

getIgnoredCollectors() : array

Returns the list of ignored collectors

Returns

array

setAjaxHandlerClass()

setAjaxHandlerClass(string  $className) 

Sets the class name of the ajax handler

Set to false to disable

Parameters

string $className

getAjaxHandlerClass()

getAjaxHandlerClass() : string

Returns the class name of the ajax handler

Returns

string

setBindAjaxHandlerToJquery()

setBindAjaxHandlerToJquery(boolean  $bind = true) 

Sets whether to call bindToJquery() on the ajax handler

Parameters

boolean $bind

isAjaxHandlerBoundToJquery()

isAjaxHandlerBoundToJquery() : boolean

Checks whether bindToJquery() will be called on the ajax handler

Returns

boolean

setBindAjaxHandlerToXHR()

setBindAjaxHandlerToXHR(boolean  $bind = true) 

Sets whether to call bindToXHR() on the ajax handler

Parameters

boolean $bind

isAjaxHandlerBoundToXHR()

isAjaxHandlerBoundToXHR() : boolean

Checks whether bindToXHR() will be called on the ajax handler

Returns

boolean

setOpenHandlerClass()

setOpenHandlerClass(string  $className) 

Sets the class name of the js open handler

Parameters

string $className

getOpenHandlerClass()

getOpenHandlerClass() : string

Returns the class name of the js open handler

Returns

string

setOpenHandlerUrl()

setOpenHandlerUrl(string  $url) 

Sets the url of the open handler

Parameters

string $url

getOpenHandlerUrl()

getOpenHandlerUrl() : string

Returns the url for the open handler

Returns

string

addAssets()

addAssets(array  $cssFiles, array  $jsFiles, string  $basePath = null, string  $baseUrl = null) 

Add assets to render in the head

Parameters

array $cssFiles

An array of filenames

array $jsFiles

An array of filenames

string $basePath

Base path of those files

string $baseUrl

Base url of those files

getAssets()

getAssets(string  $type = null, string  $relativeTo = self::RELATIVE_PATH) : array

Returns the list of asset files

Parameters

string $type

Only return css or js files

string $relativeTo

The type of path to which filenames must be relative (path, url or null)

Returns

array

getAsseticCollection()

getAsseticCollection(string  $type = null) : array

Returns a tuple where the both items are Assetic AssetCollection, the first one being css files and the second js files

Parameters

string $type

Only return css or js collection

Returns

array —

or \Assetic\Asset\AssetCollection

dumpCssAssets()

dumpCssAssets(string  $targetFilename = null) 

Write all CSS assets to standard output or in a file

Parameters

string $targetFilename

dumpJsAssets()

dumpJsAssets(string  $targetFilename = null) 

Write all JS assets to standard output or in a file

Parameters

string $targetFilename

renderHead()

renderHead() : string

Renders the html to include needed assets

Only useful if Assetic is not used

Returns

string

renderOnShutdown()

renderOnShutdown(boolean  $here = true, boolean  $initialize = true, boolean  $renderStackedData = true, boolean  $head = false) : string

Register shutdown to display the debug bar

Parameters

boolean $here

Set position of HTML. True if is to current position or false for end file

boolean $initialize

Whether to render the de bug bar initialization code

boolean $renderStackedData
boolean $head

Returns

string —

Return "{--DEBUGBAR_OB_START_REPLACE_ME--}" or return an empty string if $here == false

renderOnShutdownWithHead()

renderOnShutdownWithHead(boolean  $here = true, boolean  $initialize = true, boolean  $renderStackedData = true) : string

Same as renderOnShutdown() with $head = true

Parameters

boolean $here
boolean $initialize
boolean $renderStackedData

Returns

string

replaceTagInBuffer()

replaceTagInBuffer(boolean  $here = true, boolean  $initialize = true, boolean  $renderStackedData = true, boolean  $head = false) 

Is callback function for register_shutdown_function(.

..)

Parameters

boolean $here

Set position of HTML. True if is to current position or false for end file

boolean $initialize

Whether to render the de bug bar initialization code

boolean $renderStackedData
boolean $head

render()

render(boolean  $initialize = true, boolean  $renderStackedData = true) : string

Returns the code needed to display the debug bar

AJAX request should not render the initialization code.

Parameters

boolean $initialize

Whether or not to render the debug bar initialization code

boolean $renderStackedData

Whether or not to render the stacked data

Returns

string

getRelativeRoot()

getRelativeRoot(string  $relativeTo, string  $basePath, string  $baseUrl) : string

Returns the correct base according to the type

Parameters

string $relativeTo
string $basePath
string $baseUrl

Returns

string

makeUriRelativeTo()

makeUriRelativeTo(string|array  $uri, string  $root) : string

Makes a URI relative to another

Parameters

string|array $uri
string $root

Returns

string

filterAssetArray()

filterAssetArray(array  $array, string  $type = null) : array

Filters a tuple of (css, js) assets according to $type

Parameters

array $array
string $type

'css', 'js' or null for both

Returns

array

createAsseticCollection()

createAsseticCollection(array  $files) : \Assetic\Asset\AssetCollection

Create an Assetic AssetCollection with the given files.

Filenames will be converted to absolute path using the base path.

Parameters

array $files

Returns

\Assetic\Asset\AssetCollection

dumpAssets()

dumpAssets(array  $files, string  $targetFilename = null, boolean  $useRequireJs = false) 

Write assets to standard output or in a file

Parameters

array $files
string $targetFilename
boolean $useRequireJs

getJsInitializationCode()

getJsInitializationCode() : string

Returns the js code needed to initialize the debug bar

Returns

string

getJsControlsDefinitionCode()

getJsControlsDefinitionCode(string  $varname) : string

Returns the js code needed to initialized the controls and data mapping of the debug bar

Controls can be defined by collectors themselves or using \addControl()

Parameters

string $varname

Debug bar's variable name

Returns

string

getAddDatasetCode()

getAddDatasetCode(string  $requestId, array  $data, mixed  $suffix = null) : string

Returns the js code needed to add a dataset

Parameters

string $requestId
array $data
mixed $suffix

Returns

string