Copied to clipboard

Flag this post as spam?

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


  • Alex T 8 posts 88 karma points
    Mar 11, 2019 @ 12:53
    Alex T
    0

    Intellisense for Macros

    So with templates for normal model fields we can do:

    @Model.PageTitle
    

    Instead of:

    @Model.Value("pageTitle")
    

    This is great and much neater.

    Is there an equivalent for:

    @Umbraco.RenderMacro("myMacro")
    

    and:

    @Model.MacroParameters["myParameter"]
    

    ?

    Many thanks.

  • Dan Diplo 1554 posts 6205 karma points MVP 6x c-trib
    Mar 11, 2019 @ 13:17
    Dan Diplo
    1

    In short, no.

    I guess what you could do is create your own class of constants in C# for these values and use them eg.

    public class MyConstants
        {
            const string MyMarcoAlias = "myMacro";
        }
    
    @Umbraco.RenderMacro(MyConstants.MyMacroAlias)
    

    Only really useful if you render the same macro in a lot of different places - you can then change the alias easily. Otherwise probably not worth the effort.

  • Alex T 8 posts 88 karma points
    Mar 11, 2019 @ 16:28
    Alex T
    0

    Ah that's too bad. Ok, thanks!

Please Sign in or register to post replies

Write your reply to:

Draft