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 1505 posts 5911 karma points MVP 4x 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!

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies