/// <summary> /// Converts the specified <code>token</code> into an instance of <see cref="IGridEditorConfig"/>. /// </summary> /// <param name="editor"></param> /// <param name="token">The instance of <see cref="JToken"/> representing the editor config.</param> /// <param name="config">The converted editor config.</param> public bool ConvertEditorConfig(GridEditor editor, JToken token, out IGridEditorConfig config) { config = null; if (IsLinkPickerEditor(editor)) { config = GridEditorLinkPickerConfig.Parse(editor, token as JObject); } return config != null; }
/// <inheritdoc /> public bool ConvertEditorConfig(GridEditor editor, JToken token, out IGridEditorConfig config) { config = configTypes.ContainsKey(editor.Alias) ? (IGridEditorConfig)Activator.CreateInstance(types[editor.Alias], editor, token) : null; return(config != null); }
/// <summary> /// Converts the specified <code>token</code> into an instance of <code>IGridEditorConfig</code>. /// </summary> /// <param name="editor"></param> /// <param name="token">The instance of <code>JToken</code> representing the editor config.</param> /// <param name="config">The converted config.</param> public bool ConvertEditorConfig(GridEditor editor, JToken token, out IGridEditorConfig config) { config = null; switch (editor.Alias) { case "media_wide": case "media_wide_cropped": config = GridEditorMediaConfig.Parse(editor, token as JObject); break; case "banner_headline": case "banner_tagline": case "headline_centered": case "abstract": case "paragraph": case "quote_D": case "code": config = GridEditorTextConfig.Parse(editor, token as JObject); break; } return config != null; }
/// <summary> /// Converts the specified <paramref name="token"/> into an instance of <see cref="IGridEditorConfig"/>. /// </summary> /// <param name="editor">A reference to the parent <see cref="GridEditor"/>.</param> /// <param name="token">The instance of <see cref="JToken"/> representing the editor config.</param> /// <param name="config">The converted editor config.</param> public override bool ConvertEditorConfig(GridEditor editor, JToken token, out IGridEditorConfig config) { config = null; if (IsImagePickerEditor(editor)) { config = GridEditorImagePickerConfig.Parse(editor, token as JObject); } return(config != null); }
/// <summary> /// Converts the specified <paramref name="token"/> into an instance of <see cref="IGridEditorConfig"/>. /// </summary> /// <param name="editor"></param> /// <param name="token">The instance of <see cref="JToken"/> representing the editor config.</param> /// <param name="config">The converted editor config.</param> public bool ConvertEditorConfig(GridEditor editor, JToken token, out IGridEditorConfig config) { config = null; if (IsVideoPicker(editor)) { config = GridEditorVideoPickerConfig.Parse(editor, token as JObject); } return(config != null); }
/// <summary> /// Converts the specified <paramref name="token"/> into an instance of <see cref="IGridEditorConfig"/>. /// </summary> /// <param name="editor"></param> /// <param name="token">The instance of <see cref="JToken"/> representing the editor config.</param> /// <param name="config">The converted config.</param> public override bool ConvertEditorConfig(GridEditor editor, JToken token, out IGridEditorConfig config) { config = null; if (IsDocTypeGridEditor(editor)) { config = GridEditorDtgeConfig.Parse(editor, token as JObject); } return(config != null); }
/// <summary> /// Converts the specified <paramref name="token" /> into an instance of <see cref="IGridEditorConfig" />. /// </summary> /// <param name="editor"></param> /// <param name="token">The instance of <see cref="JToken" /> representing the editor config.</param> /// <param name="config">The converted editor config.</param> /// <returns></returns> public bool ConvertEditorConfig(GridEditor editor, JToken token, out IGridEditorConfig config) { config = null; if (this.isLeBlenderEditor(editor)) { config = GridEditorLeBlenderConfig.Parse(editor, token as JObject); } return(config != null); }
public bool ConvertEditorConfig(GridEditor editor, JToken token, out IGridEditorConfig config) { config = null; if (editor.Alias == "richtextBlock") { config = GridEditorTextConfig.Parse(editor, token as JObject); } return(config != null); }
public override bool ConvertEditorConfig(GridEditor editor, JToken token, out IGridEditorConfig config) { config = null; switch (editor.View?.Split('?')[0]) { case "/App_Plugins/Skybrud.Umbraco.Elements/Views/Grid.html": config = GridEditorElementsConfig.Parse(editor, token as JObject); return(true); } return(false); }
/// <summary> /// Converts the specified <paramref name="token"/> into an instance of <see cref="IGridEditorConfig"/>. /// </summary> /// <param name="editor"></param> /// <param name="token">The instance of <see cref="JToken"/> representing the editor config.</param> /// <param name="config">The converted config.</param> public override bool ConvertEditorConfig(GridEditor editor, JToken token, out IGridEditorConfig config) { config = null; if (IsMediaEditor(editor)) { config = new GridEditorMediaConfig(editor, token as JObject); } else if (IsTextStringEditor(editor)) { config = new GridEditorTextConfig(editor, token as JObject); } return(config != null); }
/// <summary> /// Converts the specified <paramref name="token"/> into an instance of <see cref="IGridEditorConfig"/>. /// </summary> /// <param name="editor"></param> /// <param name="token">The instance of <see cref="JToken"/> representing the editor config.</param> /// <param name="config">The converted config.</param> public virtual bool ConvertEditorConfig(GridEditor editor, JToken token, out IGridEditorConfig config) { // Just set the value to NULL initially (output parameters must be defined) config = null; // Check the alias of the grid editor switch (editor.Alias) { // Handle any further parsing of the value of our grid editor configugration case "SkriftContactPersons": config = SkriftGridEditorContactPersonsConfig.Parse(editor, token as JObject); break; } // Return whether our converter supported the editor return(config != null); }
public static void ReplaceEditorObjectFromConfig(GridControl control) { // Get the "editor" object from the JSON JObject editor = control.JObject.GetObject("editor"); // Get the alias of the editor string alias = editor == null ? null : editor.GetString("alias"); // Skip if we dont have an alias if (String.IsNullOrWhiteSpace(alias)) { return; } // Get a reference to the grid configuration IGridConfig config = Current.Configs.GetConfig <IGridConfig>(); //// Get a reference to the grid configuration //IGridConfig config = UmbracoConfig.For.GridConfig( // ApplicationContext.Current.ProfilingLogger.Logger, // ApplicationContext.Current.ApplicationCache.RuntimeCache, // new DirectoryInfo(MapPath(SystemDirectories.AppPlugins)), // new DirectoryInfo(MapPath(SystemDirectories.Config)), // HttpContext.Current == null || HttpContext.Current.IsDebuggingEnabled //); // Find the editor in the configuration IGridEditorConfig found = config.EditorsConfig.Editors.FirstOrDefault(x => x.Alias == alias); // Skip if not found if (found == null) { return; } JObject serialized = new JObject(); serialized["name"] = found.Name; serialized["alias"] = found.Alias; serialized["view"] = found.View; serialized["render"] = found.Render; serialized["icon"] = found.Icon; serialized["config"] = JObject.FromObject(found.Config); control.JObject["editor"] = serialized; }
/// <summary> /// Converts the specified <paramref name="token"/> into an instance of <see cref="IGridEditorConfig"/>. /// </summary> /// <param name="editor"></param> /// <param name="token">The instance of <see cref="JToken"/> representing the editor config.</param> /// <param name="config">The converted config.</param> public virtual bool ConvertEditorConfig(GridEditor editor, JToken token, out IGridEditorConfig config) { config = null; switch (editor.Alias) { case "media": config = GridEditorMediaConfig.Parse(editor, token as JObject); break; case "headline": case "quote": config = GridEditorTextConfig.Parse(editor, token as JObject); break; } return(config != null); }
/// <summary> /// Converts the specified <code>token</code> into an instance of <code>IGridEditorConfig</code>. /// </summary> /// <param name="editor"></param> /// <param name="token">The instance of <code>JToken</code> representing the editor config.</param> /// <param name="config">The converted config.</param> public virtual bool ConvertEditorConfig(GridEditor editor, JToken token, out IGridEditorConfig config) { config = null; switch (editor.Alias) { case "media": config = GridEditorMediaConfig.Parse(editor, token as JObject); break; case "headline": case "quote": config = GridEditorTextConfig.Parse(editor, token as JObject); break; } return config != null; }
/// <summary> /// Converts the specified <paramref name="token"/> into an instance of <see cref="IGridEditorConfig"/>. /// </summary> /// <param name="editor"></param> /// <param name="token">The instance of <see cref="JToken"/> representing the editor config.</param> /// <param name="config">The converted config.</param> public bool ConvertEditorConfig(GridEditor editor, JToken token, out IGridEditorConfig config) { config = null; switch (editor.Alias) { case "media_wide": case "media_wide_cropped": config = GridEditorMediaConfig.Parse(editor, token as JObject); break; case "banner_headline": case "banner_tagline": case "headline_centered": case "abstract": case "paragraph": case "quote_D": case "code": config = GridEditorTextConfig.Parse(editor, token as JObject); break; } return(config != null); }
public bool ConvertEditorConfig(GridEditor editor, JToken token, out IGridEditorConfig config) { config = null; return(false); }
public bool ConvertEditorConfig(Skybrud.Umbraco.GridData.GridEditor editor, Newtonsoft.Json.Linq.JToken token, out IGridEditorConfig config) { throw new NotImplementedException(); }