Do you have a particular use case in mind? I'm not sure what assigning a template to a nested content element would let you do. Since it doesn't have a URL as a standalone page, when would the template be used?
Not sure of your use case, but I can think of two options that might work depending on what you're trying to accomplish:
Infer Template You could infer the "template" from the doctype alias.
Template Drop Down You could create a drop down property on each element type that allows the "template" to be chosen (and the drop down could either pick actual templates or just be a normal drop down with a few values you've added to it).
I'd hoped to use it in order to implement "variants" for components we were building - e.g you can drop a CTA component on the page via nested content and use the templates feature to set the layout (if it's going to potentially be very different markup but the same data fields across the site).
We've gone back to the good old node/child node approach for this, which is a shame! Could have gone for the dropdown approach etc as suggested, but it was felt that "full" node doc types give you this out of the box anyway so it's maybe the best approach for now.
Element Type Templates?
It looks like templates can't be chosen for "element type" doc types, and element types are the only thing that can be placed in nested content.
This seems a wee bit restrictive to me, are there any plans/workarounds to offer the flexibility of full doc type templates in element types?
Do you have a particular use case in mind? I'm not sure what assigning a template to a nested content element would let you do. Since it doesn't have a URL as a standalone page, when would the template be used?
An element type doesn't need a template because it cannot be created in the tree so it doesn't have a url so it cannot be rendered on its own.
En element is meant to be used in other doctype 'container' like in a nested content property.
Why would you need a template?
Not sure of your use case, but I can think of two options that might work depending on what you're trying to accomplish:
Hi folks, thanks for the replies.
I'd hoped to use it in order to implement "variants" for components we were building - e.g you can drop a CTA component on the page via nested content and use the templates feature to set the layout (if it's going to potentially be very different markup but the same data fields across the site).
We've gone back to the good old node/child node approach for this, which is a shame! Could have gone for the dropdown approach etc as suggested, but it was felt that "full" node doc types give you this out of the box anyway so it's maybe the best approach for now.
is working on a reply...