mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-07-21 06:00:01 +02:00
refactor: move plugin hook methods to plugin.hooks.*
This commit is contained in:
@@ -30,7 +30,7 @@ admin.getAreas = async function () {
|
||||
{ name: 'Group Page (Right)', template: 'groups/details.tpl', location: 'right' },
|
||||
];
|
||||
|
||||
const areas = await plugins.fireHook('filter:widgets.getAreas', defaultAreas);
|
||||
const areas = await plugins.hooks.fire('filter:widgets.getAreas', defaultAreas);
|
||||
|
||||
areas.push({ name: 'Draft Zone', template: 'global', location: 'drafts' });
|
||||
const areaData = await Promise.all(areas.map(area => index.getArea(area.template, area.location)));
|
||||
@@ -42,7 +42,7 @@ admin.getAreas = async function () {
|
||||
|
||||
async function getAvailableWidgets() {
|
||||
const [availableWidgets, adminTemplate] = await Promise.all([
|
||||
plugins.fireHook('filter:widgets.getWidgets', []),
|
||||
plugins.hooks.fire('filter:widgets.getWidgets', []),
|
||||
renderAdminTemplate(),
|
||||
]);
|
||||
availableWidgets.forEach(function (w) {
|
||||
|
||||
@@ -62,7 +62,7 @@ async function renderWidget(widget, uid, options) {
|
||||
|
||||
const userLang = config.userLang || meta.config.defaultLang || 'en-GB';
|
||||
const templateData = _.assign({ }, options.templateData, { config: config });
|
||||
const data = await plugins.fireHook('filter:widget.render:' + widget.widget, {
|
||||
const data = await plugins.hooks.fire('filter:widget.render:' + widget.widget, {
|
||||
uid: uid,
|
||||
area: options,
|
||||
templateData: templateData,
|
||||
@@ -175,7 +175,7 @@ widgets.reset = async function () {
|
||||
];
|
||||
|
||||
const [areas, drafts] = await Promise.all([
|
||||
plugins.fireHook('filter:widgets.getAreas', defaultAreas),
|
||||
plugins.hooks.fire('filter:widgets.getAreas', defaultAreas),
|
||||
widgets.getArea('global', 'drafts'),
|
||||
]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user