Initial work to add user script templates

This commit is contained in:
Simone Mainardi 2021-02-19 12:54:42 +01:00
parent 7493b02a07
commit 1dd93e7845
8 changed files with 36 additions and 18 deletions

View file

@ -14,7 +14,8 @@ local user_script_template = classes.class()
-- ##############################################
function user_script_template:init()
function user_script_template:init(user_script)
self._user_script = user_script
end
-- ##############################################
@ -31,6 +32,21 @@ end
-- ##############################################
-- @brief Render user script templates for all the available user script hooks
-- @return The rendered template
function user_script_template:render(hooks_conf)
local res = {}
local plugins_utils = require "plugins_utils"
for hook, hook_conf in pairs(hooks_conf) do
res[hook] = plugins_utils.renderTemplate(self._user_script.plugin.key, self._user_script.gui.template, hook_conf)
end
return res
end
-- ##############################################
return user_script_template
-- ##############################################