Calling all developers! We invite you to provide your input on Feature Experimentation by completing this brief survey.
Calling all developers! We invite you to provide your input on Feature Experimentation by completing this brief survey.
Hi,
It's very easy. In webforms you just create a user control and inherit from ContentControlBase, just like you would do for content areas:
[TemplateDescriptor(Inherited = true)]
public partial class ImageControl : ContentControlBase
{
protected Injected UrlResolver { get; set; }
protected string ImageUrl
{
get
{
return UrlResolver.Service.GetUrl(CurrentData.ContentLink);
}
}
}
One warning though, the image will be rendered as a block element in the editor, so it's not possible to have it floating next to the text.
For future reference this is how it is done in MVC when dropping a page in the editor.
[UIDescriptorRegistration] public class PageBaseDescriptor : UIDescriptor<PageData>, IEditorDropBehavior { public EditorDropBehavior EditorDropBehaviour { get; set; } public PageBaseDescriptor() { EditorDropBehaviour = EditorDropBehavior.CreateContentBlock; } }
Is it possible to create your ownd displaytemplate for ImageData or Media in the xhtmleditor? If yes how? In this case I am using webforms but would be nice to know if it is working for MVC as well? I cant find any example for displaying media diffrently in the editor.