-
- 247 Posts
I’d like all new resources under News to use a template called news, without the parent template actually using this template, I know there’s a way of doing this in EVO using some plugin and a TV. I remember reading that this would be possible in revo but couldn’t find anything on this.
Is there a way to do this?
-
- 24,544 Posts
I think you’d have to write a custom plugin to do that. It wouldn’t need to use a TV. You’d probably tie it to OnBeforeDocFormSave and just check the parent ID and change the template if it was the News document’s ID.
If you need to change the template before the user sees the form, you could tie it to OnDocFormPrerender. I’m not positive that would work, but I’m pretty sure it would if you checked $_REQUEST[’parent’] and set _REQUEST[’template’]
There was a plugin in Evolution that used the parent template as the default template, but that’s not what you want and I don’t think it exists in Revo yet (could be wrong). If it does, you could probably modify the code to do what you want.
The inherit template plugin for Evo now has a configuration setting to either use the parent’s template or the first sibling’s template. That way you would only need to create one child resource with a template setting; the rest will be automatic.
-
- 24,544 Posts
Quote from: sottwell at Sep 07, 2010, 05:15 AM
The inherit template plugin for Evo now has a configuration setting to either use the parent’s template or the first sibling’s template. That way you would only need to create one child resource with a template setting; the rest will be automatic.
Nice. I just checked and I don’t see it for Revo.
Is there a Manager UI for it? If not, it shouldn’t be too hard to convert.
It’s just a plugin with the configuration option in its Configuration tab. I presume Revo also has configuration for its plugins?
-
- 24,544 Posts
Quote from: sottwell at Sep 07, 2010, 05:50 AM
It’s just a plugin with the configuration option in its Configuration tab. I presume Revo also has configuration for its plugins?
Yes and no. Plugins in Revo have a "Properties" tab -- essentially a grid of key/value pairs -- the equivalent of preset snippet parameters. They would work fine for this, but wouldn’t qualify as a UI. There’s probably a way to add a tab and populate it with more sophisticated configuration options (e.g., radio buttons), but I don’t know how to do it. I think you could also do it with a Custom Manager Page, but those are very time-consuming to do (at least for me).
[update] Oops, I just checked and the properties now can be in the form of a drop-down list or Yes/No option in addition to strings and integers so there is a minimal UI there. Time to rewrite the book (yet again) -- sigh.
-
- 24,544 Posts
Duh. I should have thought of that.
-
- 24,544 Posts
This is close to what you want:
http://rtfm.modx.com/display/revolution20/Field+Label except that the name will be "template," the rule will be "field default" and the value will be the ID of the desired template.
Then add the constraint from splittingred’s post above.
-
- 247 Posts
I’m just a few days into revo at this point so this is all very helpful
I was curious if it is possible to achieve this(or something similar) using the property set