Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • Ault Nathanielsz 60 posts 275 karma points
    Jun 06, 2019 @ 15:57
    Ault Nathanielsz

    URL Picker Question *v7.14, v8.0x:

    Is it possible to (easily) add another field to the (external) URL Picker? Current ones are

    • Link
    • Anchor/qstring
    • LinkTitle
    • Target(checkbox)

    I want to to add an image picker so that there is something visually attractive to accompany the link...

  • Mario 125 posts 769 karma points c-trib
    Jun 06, 2019 @ 22:27

    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)

    enter image description here

    Don't forget to configure this doctype as 'Element type' as it's going to be used in Nested Content.

    Create your Nested Content:

    enter image description here

    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)
                <a href="@urlPicker.Url">@urlPicker.Name</a>
  • Bryna 66 posts 228 karma points
    Jun 07, 2019 @ 13:29

    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

  • Ault Nathanielsz 60 posts 275 karma points
    Jun 07, 2019 @ 13:50
    Ault Nathanielsz

    @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.

Please Sign in or register to post replies

Write your reply to: