Jump to content

Recommended Posts

Posted

Hi all,

my proposal is, that every module should have an "active" checkbox, which allows to quickly deactivate it, instead of being forced to uninstall/reinstall it.

Like AdminOnSteroids had and TracyDebugger has.

Best regards!

  • Like 6
Posted

@nurkka - I agree, but a couple of things that might help you in the meantime. If you install https://processwire.com/modules/module-settings-import-export/ it will automatically backup module settings when it's uninstalled so that you can easily get settings back where they were when you reinstall it.

Also, Tracy's Module Disabler panel can be helpful to disable modules without uninstalling - the catch is that it needs advanced and debug modes turned on to work.

  • Like 9
Posted

When $config->debug and $config->advanced are true there is an "Autoload disabled" checkbox available in the module info for any autoload module. 

image.png.7bf73eded4e0fb9e27d6b609e6d0f8da.png

Checking this box disables the module in the same way as Tracy's Module Disabler panel, but might be useful on a site that doesn't have Tracy installed.

  • Like 7
  • Thanks 1
  • 9 months later...
Posted
On 5/30/2024 at 1:46 AM, nurkka said:

every module should have an "active" checkbox, which allows to quickly deactivate it, instead of being forced to uninstall/reinstall it.

 

Having an 'active' checkbox in a custom Configurable Module by default would be great.

My solution is to use hooks that inhibit module behaviour rather than disabling the module. In the module's config fields, I create a checkbox with the name 'enable'. Then, in the module hooks:

    public function ready()
    {
		// use whatever Class::function you need
        $this->addHookAfter('Page::render', $this, 'myFunction');
    }

    public function myFunction(HookEvent $event)
    {
        if(!$this->enable) return;
		// ... code to execute if enable is true
    }

    }

It doesn't disable the module but bypasses it's other functions.

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...