It's a little old but maybe https://world.optimizely.com/blogs/Anders-Hattestad/Dates/2015/2/extending-the-hyperlink-with-custom-field/ will point you in the right direction
Thanks Scott -- I did see this and gave it a shot, but I ran into the same issues others in the comments did and can't get the modal to render with the supplied code since it's based on earlier version of the CMS.
Hey Ian, I've just posted a new version of that code on my blog, which works for version 11 of the CMS. It should work for version 12 too but I haven't test it yet.
https://ynze.hashnode.dev/extending-the-hyperlink-editor-in-version-11
Hi Ian,
Did you start implementing this? I'd imagine itcould get a little tricky for a few reasons (and depending on your precise needs):
I also did a blog about customising this, specifically covering adding a telephone link option: https://jakejon.es/blog/adding-a-telephone-link-option-to-the-episerver-link-editor
I'd probably advise against doing this, but if you're already started I'd really like to hear what your approach is 😊
Hi Jake--
I have, but I've found another route that doesn't involve any Dojo customization. Essentially, I wanted to allow editors to select specific types of blocks (any inheriting `IModalContentBlock`) as a link, instead of a page. In order to do so, I needed to create a new class inheriting from `ContentRepositoryDescriptorBase`. From there, I created a custom UrlResolver class to render the links appropriately. Here is the full class below that adds the extra field I was after to the create link dialog window:
[ServiceConfiguration(typeof(IContentRepositoryDescriptor))]
public class ModalContentContentPickerDescriptor : ContentRepositoryDescriptorBase
{
public IEnumerable<Type> ModelTypes
{
get
{
return typeof(IModalContentBlock).Assembly.GetTypes()
.Where(x =>
typeof(IModalContentBlock).IsAssignableFrom(x)
&& !x.IsInterface
&& !x.IsAbstract).ToArray();
}
}
public static string RepositoryKey => "modalContentRepo";
public override string Key => RepositoryKey;
public override string Name => "Modal Content";
public override IEnumerable<Type> LinkableTypes => ModelTypes;
public override IEnumerable<Type> ContainedTypes
{
get
{
var types = ModelTypes.ToList();
types.AddRange(new[]
{
typeof(ContentFolder),
});
return types;
}
}
public override IEnumerable<Type> CreatableTypes => ModelTypes;
public override string SearchArea => "cms/blocks";
public override IEnumerable<ContentReference> Roots =>
new List<ContentReference>
{
ContentReference.SiteBlockFolder,
ContentReference.GlobalBlockFolder,
};
public override IEnumerable<Type> MainNavigationTypes
{
get
{
return new[]
{
typeof(ContentFolder)
};
}
}
}
I'm looking to support additional attributes that should get rendered by any existing Url field. Given how much CMS content already exists, I would rather not have to create a custom block to achieve this, but would love to modify this window directly. Specifically, I have several data- attributes related to click tracking I'd like to be able to give editors the option to manage on a per-link field basis.
Is that possible? Recommended, even? Thanks in advance...