New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Layout Template Restrictions #7715

mroskamp opened this Issue May 25, 2017 · 0 comments


None yet
1 participant

mroskamp commented May 25, 2017

I've created a custom content type (Promotion Landing Page) that has a LayoutPart. I'm looking to create another content type (Promotion Landing Page Template) that will allow users to create and reuse templates specifically for the Promotion Landing Page.

I see that the LayoutPart already has a "Use as Template" option, which works well. However, we'd like to restrict our Promotion Landing Page content items to allow Promotion Landing Page Template content items as templates. The current behavior seems to be that once a LayoutPart is marked as "Use as Template", then it's a valid template for all other LayoutParts.

Would there be interest in allowing restricting the template to only be allowed for specific content types? I'd be happy to develop this feature and submit a pull request, but I want to get input from the community before doing so.

Here are two ideas I had for the design of this feature:

Design 1:
My initial thought for the design is to add an additional option once the user selects "Use as Template". When this is selected, we then also prompt the user to restrict the template to only be used for specific content types. This prompt would list all content types with a LayoutPart as checkboxes, indicating whether the template is allowed for the listed content types. If the user doesn't select any content types, then the template is allowed for all layouts. If the user selects one or more content types, then the template is only allowed for those checked content types. Then, when the user goes to create a new content item, the layouts dropdown is only populated with the templates that are valid for the content type (either those layouts without restrictions, or layouts that are allowed for the content type)

Design 2:
We could flip the previous design, so that rather than the template specifying which content types it applies to, the layout-based content types specify which templates they allow. For this design, the LayoutPart has an independent option for restricting allowed templates. The option lists all layout-based content types that are templates ("Use as Layout" is checked) as checkboxes. Not selecting any template types indicates that all templates are allowed. Selecting one or more templates restricts the template dropdown to only include templates of those types.

There would be a bit of maintenance the user would have to do when adding a new layout-based content type, in some cases. With Design 1, adding a new layout type may require the user to add the new type to the list of allowed types on any restricted template types. With Design 2, adding a new template type may require the user to add the new type to the list of allowed template types on any restricted layout types.

Once again, I'm looking to hear from the Orchard community to see if this is a feature that would be worth adding to the Orchard.Layouts feature and get your thoughts on design before I move forward.

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