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
I'm trying to get macro content in one of the api methods using:
but getting an error:
Cannot return the IPublishedContent because the UmbracoHelper was not constructed with an IPublishedContent.
Can someone please point me the correct way?
For those who has the same issue or will ever have...
Not sure if it's the best way, but i've created new instance of UmbracoHelper and that helped:
UmbracoHelper helper = new UmbracoHelper(umbPage, Umbraco.TagQuery, _dicFactory, _compRenderer, Umbraco.ContentQuery, Current.UmbracoHelper.MembershipHelper);
where _dicFactory and _compRenderer are injected to existing api controller...
public UmbracoContentApiController(ICultureDictionaryFactory dicFactory, IUmbracoComponentRenderer compRenderer)
_dicFactory = dicFactory;
_compRenderer = compRenderer;
Then you can easily render macro using:
var macro = helper.RenderMacro("MacroAlias");
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted