This commit is contained in:
Barış Soner Uşaklı
2018-10-22 07:30:48 -04:00
parent 7950b254a6
commit ab7657d445
8 changed files with 74 additions and 2 deletions

View File

@@ -0,0 +1,32 @@
'use strict';
var plugins = require('../../plugins');
var hooksController = module.exports;
hooksController.get = function (req, res) {
var hooks = [];
Object.keys(plugins.loadedHooks).forEach(function (key, hookIndex) {
var current = {
hookName: key,
methods: [],
index: 'hook-' + hookIndex,
count: plugins.loadedHooks[key].length,
};
plugins.loadedHooks[key].forEach(function (hookData, methodIndex) {
current.methods.push({
id: hookData.id,
priority: hookData.priority,
method: hookData.method ? hookData.method.toString() : 'No plugin function!',
index: hookIndex + '-code-' + methodIndex,
});
});
hooks.push(current);
});
hooks.sort((a, b) => b.count - a.count);
res.render('admin/advanced/hooks', { hooks: hooks });
};