Quantcast
Channel: Optimizely Search & Navigation
Viewing all articles
Browse latest Browse all 6894

Extend Link Editor Functionality

$
0
0

I'm trying to extend Link Editor adding a new link format for phone numbers.

I added a new field to the Link Editor by exending the class EditorDescriptior as shown below:

 [EditorDescriptorRegistration(
        TargetType = typeof(string),
        UIHint = "HyperLink",
        EditorDescriptorBehavior = EditorDescriptorBehavior.PlaceLast)
    ]
    internal class CustomLinkEditorDescriptor : EditorDescriptor
    {
        public override void ModifyMetadata(ExtendedMetadata metadata, IEnumerable<Attribute> attributes)
        {
            base.ModifyMetadata(metadata, attributes);
            if (!metadata.EditorConfiguration.ContainsKey(("providers")))
            {
                return;
            }
            var providers = (metadata.EditorConfiguration["providers"] as Enumerable<object>).ToList();
            providers.Add(new
            {
                Name = "Phone Number",
                Title = "Phone Number",
                DisplayName = "Phone Number",
                WidgetType = "dijit/form/ValidationTextBox",
            });
            metadata.EditorConfiguration["providers"] = providers;
        }
    }

The result was:

Link Editor

Generated code:

<a href="/EPiServer/CMS/+351914181987">call me</a>

Expected code:

<a href="tel:+351914181987">Call me</a>

Taking into consideration the scenario explained above, is there a way to format the tag generated to meet the html specification for phone number?

Product: EPiServer CMS
Version: 11.13.2.0


Viewing all articles
Browse latest Browse all 6894

Trending Articles