Copied to clipboard

Flag this post as spam?

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


  • Drew Mayo 27 posts 128 karma points
    Nov 14, 2022 @ 23:11
    Drew Mayo
    0

    Referencing UmbracoHelper

    Is it still possible to reference UmbracoHelper in Umbraco 8 with something like the following (this is Umbraco 7 code):

    var umbracoHelper = new Umbraco.Web.UmbracoHelper(Umbraco.Web.UmbracoContext.Current);

    I've checked over the docs the best that I can, and I haven't run across anything yet. Where I need it is in 3-4 places I can't inject it into.

    Thanks in advance

  • Huw Reddick 1929 posts 6697 karma points MVP 2x c-trib
    Nov 15, 2022 @ 08:29
    Huw Reddick
    101

    I think you can also use

    var umbracoHelper = Umbraco.Web.Composing.Current.UmbracoHelper;
    
  • Nik 1614 posts 7260 karma points MVP 7x c-trib
    Nov 15, 2022 @ 09:40
    Nik
    0

    This is the best way to access it if you need the UmbracoHelper, but it also depends on what you are doing. It could be better to get access to individual services that provide the underlying functionality.

  • Drew Mayo 27 posts 128 karma points
    Nov 15, 2022 @ 19:22
    Drew Mayo
    0

    Thanks I appreciate the help --- that line was exactly what I needed

Please Sign in or register to post replies

Write your reply to:

Draft