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>();
}
}
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.
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
I looked for information in Google, but my attempts were not crowned with results :(
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:
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:
is working on a reply...