Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Is it possible to (easily) add another field to the (external) URL Picker? Current ones are
I want to to add an image picker so that there is something visually attractive to accompany the link...
I think the easiest way would be creating a Nested Content datatype where you only allow one document type that contains the Url Picker and an Image Picker.
(All examples are for V8)
Don't forget to configure this doctype as 'Element type' as it's going to be used in Nested Content.
Create your Nested Content:
Then you'll have to just add this datatype to your page doctype where you want to render it.
Then you can render it with something like:
@foreach (var link in Model.Link)
if (link.Icon != null)
<img src="@link.Icon.Url" />
//This is because it's a Multi picker, you can configure the datatype to allow a maximum of only 1 link.
foreach (var urlPicker in link.Picker)
Depending on the situation, it also might be proper to add the property on the image mediatype(or a media type derived from image). The purpose for this is so that when that same image is used elsewhere on the site, the same metadata can be used with it. If you are working on a smaller site(around 20 or so pages), the suggestion most likely won't apply
@Mario - thank you for the comprehensive reply. I was thinking along those lines - if altering the datatype was not an easy option.
@Bryna - that thought had also crossed my mind. One of the benefits of your route (either creating a new media type or doctype) is that if you later find that the URL has changed - you can change it once in this "URL Library" and all references to it throughout the website are updated. I suppose that a primary consideration as to media/doc type is whether it is ever plausible that more than one image will be needed for a single URL.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted