Hi,
Does anyone here know how you go about disabling the preview/workflow extra for different contexts? It's an extremely useful extra but can be annoying when it's not needed.
Thanks,
discuss.answer
I'm not familiar with that extra, but if it has plugins, you can disable them by right-clicking on them in the tree. That wouldn't disable them by context, though. It might work to add a context test to the top of their code. Something like this:
if ($resource->get('context_key') !== 'web') return;
If it has System Settings, you might be able to disable it by overriding them with Context Settings.
Thank you, Bob! That code did work in terms of stopping the extra being applied to the manager for specific contexts but for some reason it also stops the front end being loaded.
I was hoping to use the context settings are I did notice they have an enable/disable system setting but the context setting doesnt look to be overwriting it.
Looks like the plugin is using this piece of code in a switch statement to look up the setting on OnDocFormPrerender.
$previewEnabled = $preview->getOption('enabled');
[ed. note: lkfranklin last edited this post 8 years, 9 months ago.]
Using getOption() with a single argument should get the System Setting. You can make sure of that by changing it to:
$preview->getOption('enabled', null);
The Context Setting will definitely override that unless there's a property set or default properties involved.
You may have to manually delete the core/cache files before it takes effect. Plugins and settings are cranky about surviving a regular Clear Cache.
Thanks Bob I've tried entering null and clearing the cache but still not having much luck with it. Any other ideas ?
Does the plugin have a property set?
Is there a snippet involved that might have default properties, a property set, or properties in its snippet tag?
Does a System Setting with that key exist?
How about a User Setting or User Group Setting with that key?
Thanks for replying again!
No property sets on the plugins or snippet tags. There is a system setting that exists for both as a yes/no field type
workflow.enabled
preview.enabled
Enabled or disabling here at the system settings does work but doesn't work as a context setting.
I also just tried setting as a user group setting but still had no luck.
Let's back up. If the extra works in the Manager, the context will always be 'mgr', so there'd be no way to control it by context with a setting. If that's the case, what events is the plugin attached to?
[ed. note: BobRay last edited this post 8 years, 9 months ago.]
Ok that makes sense! Sounds like it could be quite a bit more involved then..
Here's workflow
https://imgur.com/a/mfzed
Here's preview
https://imgur.com/a/OPAFZ
Going to close this one down. I've created a new ruleset in the extra that allows for instant publishing of a revision and applied it to the contexts I want this on. The extra/create revision option still appears but it's something I can live with and does still allow for version control and use of the preview extra.
Thank you for your help on this though!