Skip to content
This repository was archived by the owner on Sep 29, 2020. It is now read-only.

add http item leblender.contentId#91

Open
croban wants to merge 1 commit intoLecoati:masterfrom
croban:master
Open

add http item leblender.contentId#91
croban wants to merge 1 commit intoLecoati:masterfrom
croban:master

Conversation

@croban
Copy link

@croban croban commented Mar 22, 2018

I had a problem with following call
//try to find one JObject jObj = JObject.Parse(Umbraco.TypedContent(component.PageId).GetPropertyValue<string>(component.PropertyAlias)); HttpContext.Items.Add("leblender-content-id", component.ComponetId); var foundGuid = jObj.Descendants().OfType<JProperty>().FirstOrDefault(p => p.Name == "guid" && p.Value.ToString() == component.ComponetId.ToString()); if (foundGuid != null && foundGuid.Parent != null) TempData.AddFormConfiguration(component.ComponetId, foundGuid.Parent.ToObject<LeBlenderModel>().Items.FirstOrDefault()?.GetAs<FormularConfiguration>());//set new data

It throws int.Parse exception...
I am inside SurfaceController action method which was called by ajax,

@soreng
Copy link
Contributor

soreng commented Jul 12, 2018

Hi @croban

Since we are reading the "id" from Request, you are able to add your own value for "id".

HttpContext.Request.Cookies.Add(new HttpCookie("id", "my-id"));
(maybe delete the cookie afterwards ;) )

It's a bit of a hack, but it may be able to help you.

I'm not really sure how you are using LeBlender here, but it dosen't seem to be a very normal usage. As I understand it, the challenge is that there is no page (PublishedContent) loaded, so LeBlender is not able to work as intended.

The UmbracoContext.Current.IsFrontEndUmbracoRequest will also be false in this case, wich causes LeBlender to think is it in the backoffice. To make this work, it needs a bit more than just overriding the id a single place.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants