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've recently hit an issue when rendering a Document Type used with Stacked Content in the back office. The Document Type has a Rich Text Editor Data Type and on this page uses a macro. When this document type is rendered in the back office I get the following error 'Cannot render a macro when there is no current PublishedContentRequest.'.
I've solved this recently on a API Controller by creating and attaching my own PublishedContentRequest but am not sure where to go with the back office. The view is as follows:
Layout = null;
<div class="@Model.Content.GetPropertyValue("theme") elearning-card">
The rendering of the bodyText line is the one which throws the error. Any help anybody can be provide will be appreciated.
It sounds like a bug with the Stacked Content previewer, as in there isn't a PublishedContentRequest associated with it.
It's one of those scenarios that I didn't consider.
Could you open an issue ticket on our github repo please?
Thanks for your quick response on this. I've opened the issue for you! Can you think of a work around I can implement until you're able to look at the issue.
Whilst here I've got a further question:
Have you any example code showing how to use a generated model for the data type - tried a few ways and don't seem to be able to get it to work. I've inherited from
@inherits Umbraco.Web.Mvc.UmbracoViewPage<CourseImageCard> where CourseImageCard is my model and get the error
Cannot bind source content type Our.Umbraco.StackedContent.Web.PreviewModel to model type papaa_models.CourseImageCard.
Appreciate all your work on Stacked content!
It's because the Our.Umbraco.StackedContent.Web.PreviewModel model isn't the content itself, (but it does wrap all the values, so yeah, can be confusing).
The PreviewModel contains 2 properties called Page (for the current page's content) and Item (for the Stacked Content's block/content).
So you could do this...
var card = Model.Item as CourseImageCard;
Then you'd have intellisense for it.
I'll take a look at the GitHub tickets during the day.(cross-linked for future reference)
Thanks that helped loads managed to now sort most issues other than those I've raised issues on gitHub.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted