Copied to clipboard

Flag this post as spam?

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


  • Lucio 24 posts 142 karma points
    Sep 09, 2016 @ 10:20
    Lucio
    0

    How to show Content Picker Name in archetype

    Morning,

    My website is using umbraco 7.4.3 and the archetype version is 1.13.1.

    My question is, having this archetype model: enter image description here

    I need to show the name of the content picker field called "Main Link" in the "Label template", but when I use {{mainLink}} it shows the Id of the node instead.

    I guess there should be an easy way because with the multi content picker fields ({{childLinks}} for this model) it shows the selected node Names instead of the Ids.

    Hope someone have the answer :)

    Cheers /Lucio

  • Paul Seal 524 posts 2888 karma points MVP 6x c-trib
    Sep 12, 2016 @ 09:37
    Paul Seal
    0

    Hi Lucio I've done this, I'll dig it out and share it.

    Cheers

    Paul

  • Paul Seal 524 posts 2888 karma points MVP 6x c-trib
    Sep 12, 2016 @ 10:05
    Paul Seal
    101

    Hi Lucio

    I can't find the project where I had to do it, but I've looked at the archetype.js file again and I think I remember all you have to do is edit the getNativeLabel function to add in the Umbraco.ContentPickerAlias case in the switch statement:

        function getNativeLabel(datatype, value, scope) {
    
        switch (datatype.selectedEditor) {
            case "Imulus.UrlPicker":
                return imulusUrlPicker(value, scope, {});
            case "Umbraco.TinyMCEv3":
                return coreTinyMce(value, scope, {});
            case "Umbraco.MultiNodeTreePicker":
                return coreMntp(value, scope, datatype);
            case "Umbraco.ContentPickerAlias":
                return coreMntp(value, scope, datatype);                
            case "Umbraco.MediaPicker":
                return coreMediaPicker(value, scope, datatype);
            case "Umbraco.DropDown":
                return coreDropdown(value, scope, datatype);
            case "RJP.MultiUrlPicker":
                return rjpMultiUrlPicker(value, scope, {});
            default:
                return "";
        }
    }
    

    You can find the file in App_Plugins > Archetype > js > archetype.js

  • Lucio 24 posts 142 karma points
    Sep 12, 2016 @ 11:40
    Lucio
    0

    Hi Paul,

    That is amazing :D Really simple solution. That worked great!! Thanks!!

    /Lucio

  • Paul Seal 524 posts 2888 karma points MVP 6x c-trib
    Sep 12, 2016 @ 12:14
    Paul Seal
    0

    You're welcome.

Please Sign in or register to post replies

Write your reply to:

Draft