Set default template for children of a ressource
Author: Marc Loehe (boundaryfunctions)
- Paste this as new plugin and connect it to system event 'OnDocFormRender'.
- Assign a new TV 'childDefaultTemplate' to each template, for which you want to define the default children template.
- Set the newly created TV to type List Box and its 'Input Option
Values' to:
@SELECT `templatename` AS `name`,`id` FROM `[[+PREFIX]]site_templates`This will fetch all available templates from the db. - Have fun!
- 2012-01-09
- Fixed bug for compatibility with modX 2.2.0
- 2011-12-14
- Initial release
I would suggest this @SELECT-binding to sort the template names like MODX does:
@SELECTtemplatenameASname,idFROM[[+PREFIX]]site_templatesORDER BYnameASCAnyhow: Great script! It's in my standard toolbox. :-)