Loads plugins templates from /modules when no template is found

This commit is contained in:
Simone Mainardi 2021-02-23 10:55:41 +01:00
parent c62c2c232e
commit 15d4672f7e

View file

@ -1000,8 +1000,15 @@ end
function plugins_utils.renderTemplate(plugin_name, template_file, context)
init_runtime_paths()
-- Locate the template file under the plugin directory
local full_path = os_utils.fixPath(plugins_utils.getPluginTemplatesDir(plugin_name) .. "/" .. template_file)
-- If no template is found...
if not ntop.exists(full_path) then
-- Attempt at locating the template class under modules (global to ntopng)
full_path = os_utils.fixPath(dirs.installdir .. "/scripts/lua/modules/user_script_templates/"..template_file)
end
return template_utils.gen(full_path, context, true --[[ using full path ]])
end