We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 42802
    • 96 Posts
    Sebastian Zahn | ingroove.uy Reply #1, 11 years, 10 months ago
    Hi there!
    I realize that most of the clients, when they create a new resource from the manager, they made it by right clicking on the left tree ( on the parent element ) > Create > Creat a document here.

    The good thing: the new document have the parent assigned, the bad thing: the template assigned is wrong, the new document have the template of the parent resource, not the corresponding template of the child resource.

    Ok, i realize that this can be fixed with rules, in the form customization section, creating a new set, action: create resource, Constraint Field: parent, Constraint: the parent id, set the default template to the child template id, and this fix this issue.

    But, this can be done with parents ids, but what happen if i want to apply this to parent documents that the client add? For example, the parent is categories, and the client can add categories...

    My question is:

    Is there a way to set the constraint field pointing to the parent template assigned? For example: parent-template = 3
    So the rule is applied to all documents in which his parent has applied certain template. This gives consistency.

    I explain correctly?

    thank you!

    Sebastián.


    [ed. note: zzseba last edited this post 11 years, 10 months ago.]
      • 4172
      • 5,888 Posts
      You could create a plugin for OnDocFormSave, which sets the template, depending on where they create resources/containers
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 42802
        • 96 Posts
        Sebastian Zahn | ingroove.uy Reply #3, 11 years, 10 months ago
        Quote from: Bruno17 at Nov 13, 2014, 07:25 AM
        You could create a plugin for OnDocFormSave, which sets the template, depending on where they create resources/containers

        Hi Bruno! Thank for your reply

        Yes, i could, but i don´t know how! smiley

        Is there a simpler way? smiley
          • 42802
          • 96 Posts
          Sebastian Zahn | ingroove.uy Reply #4, 11 years, 10 months ago
          I think this could do the job.
          http://modx.com/extras/package/inherittemplate

          This create a tv assigned to a template, where you set the child template.
          I found that from customization manager, i can create a rule for the parent template, and assign a default value to the inherittemplate tv. wink
          So the cliente create the resource, asign the parent template, and loads the inherittemplate with child template value assigned in the rule... perfect! smiley

          [ed. note: zzseba last edited this post 11 years, 10 months ago.]