Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Anyone have a example of using UmbracoHelper in V8:
Above docs are not updated for V8 yet.
I'm trying to use within a form partial to grab a dictionary item.
It depends a bit on where you're using it but if you're in any class that inherits from an Umbraco base class (a SurfaceController for example), Umbraco is the UmbracoHelper, so you can go:
var dictionary = Umbraco.GetDictionaryValue("testing");
Thanks, I'm within the default Umbraco Forms partial view, Umbraco.GetDictionaryValue is not available.
Trying to get around this issue: https://issues.umbraco.org/issue/CON-1161
Aha, gotcha, this should work:
Pure genuis! Give this guy a trophy :D
Perfect, thank you.
And if one should use the UmbracoHelper in a custom class or service etc., this syntax normally works in v7:
var umbracoHelper = new Umbraco.Web.UmbracoHelper(Umbraco.Web.UmbracoContext.Current);
But it fails in v8 - is there a new way of doing this now?
@Thomsen - you would use dependency injection (I wrote a bit more about that here) to get the thing you want from the UmbracoHelper, however if you're in any class that inherits from an Umbraco base class (a SurfaceController for example), Umbraco IS the UmbracoHelper so you'll want to try typing Umbraco. and look at the autocomplete.
If that doesn't give you what you're looking for then leave a comment with what exactly you would want to get from the UmbracoHelper and I'll help you along. Most people would probably be looking for the content cache, I wrote a bit more about that here: https://our.umbraco.com/forum/umbraco-8/96165-v8-umbracohelpercontent-and-umbracohelpertypedcontent-where-has-it-gone#comment-304114
Hi Sebastian, I need to be able to query the ContentAtRoot from within my general functions, as the user needs to be able to add an admin email into the backoffice, and my general email function needs to be able to 'see' it. (Also need to get to the richtext box as the user can enter a footer for all emails)
The code you linked to has little in the way of explanation ie: When the namespace is Umbraco8 is that == YourProjectName or does it have to be the former?
Do you know what would be best practice to do what I need to do?
I have noticed several other explanations, however I also need to know how to call these functions from within code that does not have access to the UmbracoHelper models. All your examples seem to be geared towards running them from a viewpage or some other area exposed to these models. I'm guessing I am missing something pretty big, so thanks for any examples you can give.
We had some issue in version 7.x where the GetDictionaryValue was hitting the database each time we use it. At that time we decide to use Vettvangur.DictionaryHelper who cache the dictionary on startup.
Anyone know if this issue is fix in Umbraco 8?
Anyone know how to get access to UmbracoHelper > Dictionary items within a PropertyValueConverter?
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted