Copied to clipboard

Flag this post as spam?

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


  • Kieron 152 posts 390 karma points
    Oct 12, 2018 @ 15:06
    Kieron
    0

    Macro with Content Picker parameter

    Hi guys, attempting to use a content picker in a macro to embed something in RTE, ive been trying stuff like @Model.MacroParameters["story"];

    And I think its good, but i am getting umb://document/4d9e2aff192e409c845e808d3f4ea5fd;

    My entire macro partial view is only this currently:

    @inherits Umbraco.Web.Macros.PartialViewMacroPage
    @Model.MacroParameters["story"];
    

    Not sure what the above is, so how would i turn that into something I can access properties of the item, such as images, title, dates etc.

    Thanks!

  • Kieron 152 posts 390 karma points
    Oct 12, 2018 @ 15:57
    Kieron
    100
    var storyId = Model.MacroParameters["story"];
    var storyContent = Umbraco.TypedContent(storyId);
    
    @storyContent.Name
    @storyContent.Url
    @storyContent.Id
    @storyContent.GetPropertyValue("yourCustomProperty")
    

    fix^

  • nickornotto 403 posts 907 karma points
    Mar 16, 2019 @ 00:48
    nickornotto
    0

    It doesn't work for me.

    I have:

    var moreId = Model.MacroParameters["more"];
    var more = Umbraco.TypedContent(moreId);
    

    and more just returns null

    I am using Umbraco 7.6.0

Please Sign in or register to post replies

Write your reply to:

Draft