Multiple widget views
Multiple widget views
When selecting a type to display widgets from it would be nice to be able to have the option of selecting between several widget.html templates, similar to the way you can select a template when creating a new page.
Is this possible somehow already?
1 Answer
1
You can include a subType
field in your widget's schema:
subType
addFields: [
name: 'subType',
type: 'select',
choices: [
value: 'red',
label: 'Red'
,
value: 'blue',
label: 'Blue'
]
]
Then, in your widget.html
file, you can write:
widget.html
% include data.widget.subType + '.html' %
Now create red.html
and blue.html
templates and you should be off to the races.
red.html
blue.html
Hope this is helpful!
Thanks for contributing an answer to Stack Overflow!
But avoid …
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
But avoid …
To learn more, see our tips on writing great answers.
Required, but never shown
Required, but never shown
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.