How could I resolve plugin warning about setting "set hookData.html"
-
My plugin uses filter:widget.render hook, and recently when I upgrade my forum, the warning shows I need to set hookData.html. Is there any documentation about this? Thanks in advance.
-
@baris said in How could I resolve plugin warning about setting "set hookData.html":
data.h
Clould you explain what to change here and why @baris?
exports.filter_widget_render_minecraft_stats = function(widget, callback) { var current_time = (new Date()).getTime(); nodebb.app.render('widgets/minecraft_stats', { html: '<div id="tablediv"></div>', time: current_time }, function(err, html) { callback(null, html); }); };
I also have this in the log:
9/12 15:11:34 [453] - warn: [upgrade/appendPluginScripts] Unable to read plugin.json for plugin
nodebb-widget-minecraft-essentials
. Skipping.But i have a plugin.json
-
That warning occurs when the plugin isn't in node_modules. If you linked the plugin in, you might try
npm link nodebb-plugin-minecraft-essentials
again -
@jenkler said in How could I resolve plugin warning about setting "set hookData.html":
exports.filter_widget_render_minecraft_stats = function(widget, callback)
{
var current_time = (new Date()).getTime();nodebb.app.render('widgets/minecraft_stats', { html: '<div id="tablediv"></div>', time: current_time }, function(err, html) { callback(null, html); });
};
To fix this just change it to
exports.filter_widget_render_minecraft_stats = function(widget, callback) { var current_time = (new Date()).getTime(); nodebb.app.render('widgets/minecraft_stats', { html: '<div id="tablediv"></div>', time: current_time }, function(err, html) { widget.html = html; callback(err, widget); }); };
-
@baris said in How could I resolve plugin warning about setting "set hookData.html":
widget.html = html;
Thanks, seams to work