Is there a way to customize how the dialog for adding a new link is presented to the editor in properties of type LinkItemCollection? (Episerver 8)
Say if the client does not want the "Link name/text" to be mandatory, is there a way to customize or override this?
Thanks in advance!
Check out EditorDescriptors...
to get you started.
Then you have a large list of examples and guides
Thanks Daniel. I'm familiar with EditorDescriptors, we don't want to build though a Dojo property for this. But there might actually not be a way to customize the dialog for adding links to the LinkItemCollection.. at least I've search and still haven't found any.
My best guess is to use dotPeek and modify Episervers own implementation and smack a UIhint on the property. Might be a better way but not that I know of...
I'd suggest you to take a slightly different approach, it will be way less time and cleaner as well. I don't think you'll be able to fully customize built-in properties, especially those that are somewhat legacy from older versions, like LinkItemCollection.
Create a block called Link and give it the properties you need, ex. Url, Target and Name/Title. Then create a simple rendering of <a> tag and add content area to the page instead of LinkItemCollection. You can then decorate Name/Title with [Required].
If you'd like to still want to have all of the exactly the same features as LinkItemCollection or you already have some field filled in, I am afraid you'll need to go with something similar to this:
If you are lucky, something like this:
with [Required] on the property you want required might do the trick (but I would expect the dojo part will also not contain clientside logic that won't work the way you expect it, so you'd need to inherit/override the widget, but that might go down the path of endless rewriting).
The third option is adding custom validation server side that would be triggered only after the page is saved, but would allow you to prevent the editor from publishing a page that has empty titles, if that's good enough.
That was a bunch of good suggestions! Thank you!
I think the idea of just replacing the LinkItemCollection with a ContentArea and creating a block type with similiar properties as LinkItem is the simplest and most flexible solution. Trying to extend the property and the Dojo-widget sounds like lots of work that can be achieved in easier ways.
Unfortunately the client set low priority on this se we dropped it.
Glad I could help :)
Is there a simple way to customize the LinkItemCollection to only accept page references?
Check out the ContentReferenceList property type instead. You can restrict that one to only accept certain content as well...
Excellent! Thank you, @Daniel.