Copied to clipboard

Flag this post as spam?

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


  • pbl_dk 150 posts 551 karma points
    Dec 02, 2018 @ 13:59
    pbl_dk
    0

    Custom Macro Parameter options

    Hi there. I was thinking of building two custom macro parameters, but I need to transfer IPublished content and IEnumerable(string) as parameters. Is there somewhere I can see which types are allowed as parameters?

    I found this snippet, is says a valueType of "STRING" is allowed. But are there more?

    {
     "propertyEditors": [ 
     {
        "alias": "tooorangey.ImagePosition",
        "name": "Image Position",
        "isParameterEditor": true,
        "editor": {
            "view": "~/App_Plugins/tooorangey.ImagePosition/ImagePosition.html",
            "valueType": "STRING"
        }
    }],
     "javascript": [
        "~/App_Plugins/tooorangey.ImagePosition/ImagePosition.controller.js"
     ]
    }
    
  • Kevin Jump 2342 posts 14889 karma points MVP 8x c-trib
    Dec 02, 2018 @ 19:41
    Kevin Jump
    100

    Hi,

    I am not sure their is a nice clean way to pass content and enumerables from macros like there is with other properties.

    For property editors, your choices are STRING, TEXT, INT, DATETIME and JSON (see doc)

    To pass with content or a list of content items the core property editors either just pass a single contentId as a INT or if there are more a comma delimited list of ints (e.g 1491,2918,1948) (you can see this if you search the umbraco source code for PropertyEditorValueTypes)

    if you need to pass a range of values, the best option you have is to use JSON datatype and deserialize the values in your Macro Script once its been passed over.

    Kevin

  • pbl_dk 150 posts 551 karma points
    Dec 02, 2018 @ 20:36
    pbl_dk
    0

    Hi Kevin.

    Thanks for info and links. JSON will do just fine!

    cheers! /Peter

Please Sign in or register to post replies

Write your reply to:

Draft