Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Mike Chambers 636 posts 1253 karma points c-trib
    Jan 19, 2021 @ 09:30
    Mike Chambers
    0

    core property editors.. overriding fromEditor and toEditor

    I see that we can override the propertyValueConvertors in umbraco 8... by removing and registering an alternative.. https://our.umbraco.com/documentation/extending/property-editors/value-converters

    Is there a corresponding technique to override the corresponding PropertyEditor : DataEditor?

    such as... https://github.com/umbraco/Umbraco-CMS/blob/v8/contrib/src/Umbraco.Web/PropertyEditors/GridPropertyEditor.cs

    I'd like to extend the fromEditor/toEditor for our specific needs.

    ta.

  • iNETZO 136 posts 499 karma points c-trib
    Dec 24, 2021 @ 18:34
    iNETZO
    0

    Hi Mike,

    I would also like to extend the fromEditor to dynamicly set the pasted image folder for the grid rte. Did you find a solution for this?

    Best regards,,

    iNETZO

  • Mattie Saddler 2 posts 72 karma points
    Dec 28, 2021 @ 12:07
    Mattie Saddler
    0

    I looked for information in Google, but my attempts were not crowned with results :(

  • Richard Ockerby 39 posts 214 karma points MVP 4x c-trib
    Dec 07, 2022 @ 16:18
    Richard Ockerby
    1

    Very late to the party with this one, but I recently wanted to create a custom view for a Textbox property editor (late-ish into a project so didn't want to go through and change the property editor to a custom one). This was done in v10, but the idea is the same.

    First make your new property editor, changing the setup that points to the new view:

    using Umbraco.Cms.Core;
    using Umbraco.Cms.Core.IO;
    using Umbraco.Cms.Core.PropertyEditors;
    
    namespace Something.PropertyEditors
    {
        [DataEditor(
            Constants.PropertyEditors.Aliases.TextBox,
            EditorType.PropertyValue | EditorType.MacroParameter,
            "Textbox",
            "/custom_backoffice/views/propertyeditors/customtextbox/customtextbox.html", // This is the path to the view, 
            Group = Constants.PropertyEditors.Groups.Common,
            ValueEditorIsReusable = true)]
        public class CustomTextboxPropertyEditor : TextboxPropertyEditor
        {
            public CustomTextboxPropertyEditor(IDataValueEditorFactory dataValueEditorFactory, IIOHelper ioHelper) : base(dataValueEditorFactory, ioHelper)
            {
            }
        }
    }
    

    Then add your custom view to /wwwroot/custom_backoffice/views/propertyeditors/customtextbox/customtextbox.html. This can be whatever you want but as I am overriding the core Textbox I used that as a base (found here)

    Lastly remove the core property editor from the collection (otherwise Umbraco will have 2 TextboxPropertyEditors referenced and throw a runtime error when it comes to rendering). You can do this in a composer:

    using Umbraco.Cms.Core.Composing;
    using Umbraco.Cms.Core.DependencyInjection;
    using Umbraco.Cms.Core.PropertyEditors;
    
    public class CoreComposers : IComposer
    {
        public void Compose(IUmbracoBuilder builder)
        {
            builder.DataEditors().Exclude<TextboxPropertyEditor>();
        }
    }
    
  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies