-
Notifications
You must be signed in to change notification settings - Fork 610
/
Module.php
54 lines (46 loc) · 1.28 KB
/
Module.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
/**
* @link https://craftcms.com/
* @copyright Copyright (c) Pixel & Tonic, Inc.
* @license https://craftcms.github.io/license/
*/
namespace craft\debug;
use Craft;
use craft\base\FsInterface;
use craft\web\View;
/**
* The Yii Debug Module provides the debug toolbar and debugger
*
* @author Pixel & Tonic, Inc. <support@pixelandtonic.com>
* @since 3.0.0
*/
class Module extends \yii\debug\Module
{
/**
* @var FsInterface|null The filesystem that debug cache files should be stored in.
* @since 4.0.0
*/
public ?FsInterface $fs = null;
/**
* @inheritdoc
*/
public function bootstrap($app): void
{
parent::bootstrap($app);
$this->logTarget = $app->getLog()->targets['debug'] = new LogTarget($this);
}
/**
* @inheritdoc
*/
public function renderToolbar($event): void
{
if (!$this->checkAccess() || Craft::$app->getRequest()->getIsAjax()) {
return;
}
/** @var View $view */
$view = $event->sender;
echo $this->getToolbarHtml();
echo '<style>' . $view->renderPhpFile($this->getBasePath() . '/assets/css/toolbar.css') . '</style>';
echo '<script>' . $view->renderPhpFile($this->getBasePath() . '/assets/js/toolbar.js') . '</script>';
}
}