Exemple #1
0
        public static void Clone(string nameToClone, TemplateInfo templateInfo, string templateHtml = null)
        {
            var directoryPath = Context.PluginApi.GetPluginPath(FormUtils.PluginId, "templates");

            FormUtils.CopyDirectory(FormUtils.PathCombine(directoryPath, nameToClone), FormUtils.PathCombine(directoryPath, templateInfo.Name), true);

            var configJson = Context.UtilsApi.JsonSerialize(templateInfo);
            var configPath = FormUtils.PathCombine(directoryPath, templateInfo.Name, "config.json");

            FormUtils.WriteText(configPath, configJson);

            if (templateHtml != null)
            {
                SetTemplateHtml(templateInfo, templateHtml);
            }
        }