/// <summary> /// Set custom widgets for the given area /// If `widgets` is null then remove the specification /// </summary> /// <param name="areaId">Area id</param> /// <param name="widgets">Custom widgets</param> public virtual void SetCustomWidgets(string areaId, IList <TemplateWidget> widgets) { // Remove cache CustomWidgetsCache.Remove(areaId); // Write to file var file = GetCustomWidgetsFile(areaId); if (widgets != null) { file.WriteAllText(JsonConvert.SerializeObject(widgets, Formatting.Indented)); } else { file.Delete(); } }
/// <summary> /// Set custom widgets for the given area /// If `widgets` is null then remove the specification /// </summary> /// <param name="areaId">Area id</param> /// <param name="widgets">Custom widgets</param> public virtual void SetCustomWidgets(string areaId, IList <TemplateWidget> widgets) { // Remove cache CustomWidgetsCache.Remove(areaId); // Write to file var path = GetCustomWidgetsJsonPath(areaId); PathUtils.EnsureParentDirectory(path); if (widgets != null) { File.WriteAllText(path, JsonConvert.SerializeObject(widgets, Formatting.Indented)); } else { File.Delete(path); } }