dolibarr
21.0.0-beta
Main Page
Related Pages
Topics
Classes
Files
File List
File Members
dolibarr_dev
htdocs
debugbar
class
DataCollector
DolHooksCollector.php
Go to the documentation of this file.
1
<?php
2
/* Copyright (C) 2024 Laurent Destailleur <eldy@users.sourceforge.net>
3
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
4
*
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 3 of the License, or
8
* (at your option) any later version.
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this program. If not, see <https://www.gnu.org/licenses/>.
17
*/
18
25
use DebugBar\DataCollector\RequestDataCollector;
26
30
class
DolHooksCollector
extends
RequestDataCollector
31
{
37
public
function
collect
()
38
{
42
global $hookmanager;
43
44
$data = [
'hooks'
=> [],
'nb_of_hooks'
=> 0];
45
if
(empty($hookmanager->hooksHistory)) {
46
return
$data;
47
}
48
$i = 0;
49
foreach
($hookmanager->hooksHistory as $key => $hookHistory) {
50
$i++;
51
$hookHistory[
'contexts'
] = implode(
', '
, $hookHistory[
'contexts'
]);
52
$data[
'hooks'
][
"[$i] {$hookHistory['name']}"
] = $hookHistory;
53
54
// $data["[$key] {$hookHistory['name']}"] = "{$hookHistory['file']} (L{$hookHistory['line']}). Contexts: "
55
// . implode(', ', $hookHistory['contexts']);
56
}
57
$data[
'nb_of_hooks'
] = count($data[
'hooks'
]);
58
59
return
$data;
60
}
61
67
public
function
getWidgets
()
68
{
69
global $langs;
70
71
$langs->load(
"other"
);
72
73
return
[
74
$langs->transnoentities(
'Hooks'
) => [
75
"icon"
=>
"tags"
,
76
"widget"
=>
"PhpDebugBar.Widgets.HookListWidget"
,
77
"map"
=>
"hooks.hooks"
,
78
"default"
=>
"{}"
79
],
80
"{$langs->transnoentities('Hooks')}:badge"
=> [
81
"map"
=>
"hooks.nb_of_hooks"
,
82
"default"
=> 0
83
]
84
];
85
}
86
90
public
function
getName
()
91
{
92
return
'hooks'
;
93
}
94
}
DolHooksCollector
DolRequestDataCollector class.
Definition
DolHooksCollector.php:31
DolHooksCollector\collect
collect()
Collects the data from the collectors.
Definition
DolHooksCollector.php:37
DolHooksCollector\getName
getName()
Definition
DolHooksCollector.php:90
DolHooksCollector\getWidgets
getWidgets()
Return widget settings.
Definition
DolHooksCollector.php:67
Generated on Sun Dec 1 2024 01:00:29 for
dolibarr
by Doxygen 1.11.0