We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22797
    • 134 Posts
    Is there a built-in way to turn plugins on or off depending on the active 1) page, 2) template, or 3) context? or perhaps only on certain 4) fields or 5) template variables?

    I guess I already know that the answer is no (unless I’ve missed something), but I ask because many of the plugins are performing potentially resource-intensive actions such as regex search and replace. When you run multiple plugins of this type, I assume it will negatively affect performance. It would be nice to have a flag that says "yes, run plugin x here" or "no, don’t run plugin x here."

    I suppose there are ways of writing code in the plugin itself to check for certain conditions (e.g. if $id==’123’ or if $content !=’’ and so on), but hard coding things like this into the plugin doesn’t seem like the best approach. It’s great that we have different events to choose from (though I’ll put in another reminder to make sure the right-click document tree events are also taken into account http://modxcms.com/bugs/task/1020), and it would be even better if we also could activate or deactivate a plugin depending on the page/template/context etc., preferably by checking a box on the page itself (or on the template itself, or in the context itself).

    I’d still want the option to always run the plugin everywhere, but in the interest of overall performance, I don’t want to be limited to that.