We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 17301
    • 932 Posts
    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,

    This question has been answered by BobRay. See the first response.

      ■ email: [email protected] | ■ website: https://alienbuild.uk

      The greatest compliment you can give back to us, is to spend a few seconds leaving a rating at our trustpilot: https://uk.trustpilot.com/review/alienbuild.uk about the service we provided. We always drop mention of services offered by businesses we've worked with in the past to those of interest.
    • discuss.answer
      • 3749
      • 24,544 Posts
      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.
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 17301
        • 932 Posts
        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.]
          ■ email: [email protected] | ■ website: https://alienbuild.uk

          The greatest compliment you can give back to us, is to spend a few seconds leaving a rating at our trustpilot: https://uk.trustpilot.com/review/alienbuild.uk about the service we provided. We always drop mention of services offered by businesses we've worked with in the past to those of interest.
          • 3749
          • 24,544 Posts
          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.

            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting
            • 17301
            • 932 Posts
            Thanks Bob I've tried entering null and clearing the cache but still not having much luck with it. Any other ideas ?
              ■ email: [email protected] | ■ website: https://alienbuild.uk

              The greatest compliment you can give back to us, is to spend a few seconds leaving a rating at our trustpilot: https://uk.trustpilot.com/review/alienbuild.uk about the service we provided. We always drop mention of services offered by businesses we've worked with in the past to those of interest.
              • 3749
              • 24,544 Posts
              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?
                Did I help you? Buy me a beer
                Get my Book: MODX:The Official Guide
                MODX info for everyone: http://bobsguides.com/modx.html
                My MODX Extras
                Bob's Guides is now hosted at A2 MODX Hosting
                • 17301
                • 932 Posts
                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.
                  ■ email: [email protected] | ■ website: https://alienbuild.uk

                  The greatest compliment you can give back to us, is to spend a few seconds leaving a rating at our trustpilot: https://uk.trustpilot.com/review/alienbuild.uk about the service we provided. We always drop mention of services offered by businesses we've worked with in the past to those of interest.
                  • 3749
                  • 24,544 Posts
                  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.]
                    Did I help you? Buy me a beer
                    Get my Book: MODX:The Official Guide
                    MODX info for everyone: http://bobsguides.com/modx.html
                    My MODX Extras
                    Bob's Guides is now hosted at A2 MODX Hosting
                    • 17301
                    • 932 Posts
                    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


                      ■ email: [email protected] | ■ website: https://alienbuild.uk

                      The greatest compliment you can give back to us, is to spend a few seconds leaving a rating at our trustpilot: https://uk.trustpilot.com/review/alienbuild.uk about the service we provided. We always drop mention of services offered by businesses we've worked with in the past to those of interest.
                      • 17301
                      • 932 Posts
                      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!
                        ■ email: [email protected] | ■ website: https://alienbuild.uk

                        The greatest compliment you can give back to us, is to spend a few seconds leaving a rating at our trustpilot: https://uk.trustpilot.com/review/alienbuild.uk about the service we provided. We always drop mention of services offered by businesses we've worked with in the past to those of interest.