Copied to clipboard

Flag this post as spam?

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


  • Bezmundo 48 posts 139 karma points
    May 12, 2016 @ 16:47
    Bezmundo
    0

    Using Related Links in a custom as Umbraco macro for grid

    I've tried to port the related link property type to a custom macro parameter. The template loads once selected in the grid but it cannot read the max value stored in the property type.

    Any ideas

       alias: "Demo.CTALink",
            name: "CTA Link",
            isParameterEditor: true,
            editor: {
            view: "relatedlinks"
    

    I've tried calling the umbraco.controllers.js through the javascript and assigning a prevalue for the max value but still no luck.

    Heres the output: Console error shown

  • Paul de Quant 403 posts 1520 karma points
    Aug 25, 2017 @ 16:24
    Paul de Quant
    0

    Did you manage to get this working?

    Thanks

  • Marc Goodson 2126 posts 14218 karma points MVP 8x c-trib
    Aug 27, 2017 @ 21:28
    Marc Goodson
    0

    Hi Paul

    The trick is to supply a defaultConfig option in the package manifest file;

    https://our.umbraco.org/Documentation/Extending/Macro-Parameter-Editors/

    eg

     alias: "Demo.CTALink",
            name: "CTA Link",
            isParameterEditor: true,
            editor: {
            view: "relatedlinks"
            },
    defaultConfig: {
       maxValue: 4
    }
    

    regards

    Marc

  • Paul de Quant 403 posts 1520 karma points
    Aug 29, 2017 @ 09:00
    Paul de Quant
    0

    Hi Marc,

    Thanks for this, it works but the only downside is that it doesn't show all the options. It seems to crop off the new window and the add button.

    Is there a way to show everything?

    Thanks

    Paul

  • Marc Goodson 2126 posts 14218 karma points MVP 8x c-trib
    Aug 29, 2017 @ 22:44
    Marc Goodson
    0

    Hi Paul

    I see what you mean!

    The RJP.MultiUrl picker is probably better suited as a macro parameter:

    https://our.umbraco.org/projects/backoffice-extensions/multi-url-picker/

    but if you were set on using relatedlinks you could add a stylesheet to your package manifest file:

    {
        propertyEditors: [
         {
            alias: "RelatedLinksTest",
            name: "Related Links Test",
            editor: {                                           
            view: "relatedlinks",
            hideLabel:false
            },
            isParameterEditor:true,
            defaultConfig: {
                  maxValue: 4
          }
        }],
          css: [
    '~/App_Plugins/RelatedLinksMacroParameter/relatedLinksMacroParameter.css',
       ]
    }
    

    and then apply some styling rules for the situation when the related links view appears in a macro overlay eg:

    .umb-overlay-right .umb-relatedlinks {
    overflow-x:auto;
    }
    

    would add a scroll bar..

    enter image description here

    but you may be able to style it better, basically it's a table!

    I would tend to use the RJP multi url picker here, as whilst this is a third party plugin, it appears to behave more closely to the core content pickers than the relatedlinks user interface and it fits!

Please Sign in or register to post replies

Write your reply to:

Draft