We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 20909
    • 19 Posts
    Hello,

    I was wondering if there is a possibility to let a Plugin only be executed "OnDocFormRender" when a SPECIFIC Template is selected?


    Its actually a quiet simple "plugin".

    It does only work in manager. So when somebody wants to make a change of a document or creates a new document, a link appears at the bottom which makes it possible to upload pictures into a gallery only for THIS document.
    This link shall only appear when lets say the template selected is "TEST".

    It has to work like the Template Variables, which do only show up to get fed with inputs, when a specific template is selected.


    Hope someone can help me.


    Regards,
    name
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      I would think you could have an "if" condition checking on which template is being used, and only run the plugin code if the desired template is in use.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 20909
        • 19 Posts
        Hi thanks for the reply, but actually I don’t know in what Variable the name (or ID?) of the Template is stored?

        Perhaps someone knows?

        By the way, does someone know in what Variable the document ID is stored (in backend/manager!). For now I have just read it from GET.
          • 6726
          • 7,075 Posts
          the ID of the template is stored in the modx_site_content table, the field name is... template smiley
            .: COO - Commerce Guys - Community Driven Innovation :.


            MODx est l'outil id
            • 20909
            • 19 Posts
            Ahh, all right, thanks laugh

            Now if just someone knew how to get the document_id out of the manager (when changing page), so i dont have to get the id via $_GET.