U4-5905 - Add bool to PublishedContentRequest to indicate wether an altTemplate was specified

Created by Danny Drogt 27 Nov 2014, 16:41:03 Updated by Shannon Deminick 26 Jun 2017, 06:40:03

I would like to know in the PublishedContentRequest pipeline (specifically in the Prepared event) wether the current request had an altTemplate specified.

This could be achieved by adding a bool property to PublishedContentRequest and setting it in PublishedContentRequestEngine.FindTemplate() when an alternate was specified.

(would be able to make this change myself, but am completely new to contributing to the source)

Comments

Stephan 27 Nov 2014, 16:48:26

So you would like to know whether you are rendering using the "expected" template (ie the template that was specified on the content item) or using the "alternate" template (ie the template that was forced one way or another). Correct?


Danny Drogt 27 Nov 2014, 16:51:17

Yes. I'm currently building a kind of multi-tenant system and using the Prepared event to dynamically set templates based on configuration. But when an altTemplate was specified, I want to just use that one. Right now I'm using System.Web.HttpContext.Current.Request.QueryString to check if altTemplate was set.

The PCRE already has a nice flow which detects if an altTemplate was specified. Would be great to pass along that information in the PCR itself.


Stephan 27 Nov 2014, 16:54:19

If that's the case...

We already have an IsInitialPublishedContent boolean value which indicates whether the current PublishedContent is the content that was "found" by the IContentFinder - or if it's been changed (eg via internal redirect) and we're not displaying the expected content. We use it when redirecting (internally) the user to eg the login page.

And it precisely exist in order to detect whether altTemplate should apply, because you don't want to apply an altTemplate to the login page.

So I'd be happy with an IsInitialTemplate boolean value which would indicate whether the template is ''the default template that should be used for the content'' or another one. The FindTemplate() method would need to set that boolean... but also the content finders...

Nothing against it, to the contrary, but somebody needs to think about the details ;-)


Danny Drogt 27 Nov 2014, 16:58:08

Thanks, great comment and explanation for more insight, that's why your the pipeline boss ;-)


Shannon Deminick 26 Jun 2017, 06:40:03

Closing issue due to inactivity - see blog post for details https://umbraco.com/blog/issue-tracker-cleanup/


Priority: Normal

Type: Feature (request)

State: Closed

Assignee:

Difficulty: Very Easy

Category: Architecture

Backwards Compatible: True

Fix Submitted: None

Affected versions:

Due in version:

Sprint:

Story Points:

Cycle: