mirror of
https://github.com/filp/whoops.git
synced 2026-09-18 05:36:21 +00:00
Merge pull request #662 from basteyy/patch-1
Add method for adding custom javascript files
This commit is contained in:
@@ -51,6 +51,13 @@ class PrettyPageHandler extends Handler
|
||||
*/
|
||||
private $customCss = null;
|
||||
|
||||
/**
|
||||
* The name of the custom js file.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $customJs = null;
|
||||
|
||||
/**
|
||||
* @var array[]
|
||||
*/
|
||||
@@ -199,6 +206,10 @@ class PrettyPageHandler extends Handler
|
||||
$customCssFile = $this->getResource($this->customCss);
|
||||
}
|
||||
|
||||
if ($this->customJs) {
|
||||
$customJsFile = $this->getResource($this->customJs);
|
||||
}
|
||||
|
||||
$inspector = $this->getInspector();
|
||||
$frames = $this->getExceptionFrames();
|
||||
$code = $this->getExceptionCode();
|
||||
@@ -258,6 +269,10 @@ class PrettyPageHandler extends Handler
|
||||
$vars["stylesheet"] .= file_get_contents($customCssFile);
|
||||
}
|
||||
|
||||
if (isset($customJsFile)) {
|
||||
$vars["javascript"] .= file_get_contents($customJsFile);
|
||||
}
|
||||
|
||||
// Add extra entries list of data tables:
|
||||
// @todo: Consolidate addDataTable and addDataTableCallback
|
||||
$extraTables = array_map(function ($table) use ($inspector) {
|
||||
@@ -625,6 +640,17 @@ class PrettyPageHandler extends Handler
|
||||
$this->customCss = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a custom js file to be loaded.
|
||||
*
|
||||
* @param string $name
|
||||
* @return void
|
||||
*/
|
||||
public function addCustomJs($name)
|
||||
{
|
||||
$this->customJs = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user