Jump to content

Modules::saveConfig Hook does not fire anymore [SOLVED]


Recommended Posts

Today I have discovered a strange behavior: On the latest dev version of ProcessWire my Modules::saveConfig Hooks does not fire anymore. This hook should fire after a module configuration has been saved.

I got no entry inside the error logs and testing it with Tracy does not give me any information. The hook runs inside the init function inside a module:

    public function init():void
    {
        $this->wire->addHookAfter('Modules::saveConfig', function(HookEvent $event) {
            $event->message("You saved the module config");
        });
    }

The method above is only for testing purposes, but it outputs nothing if I hit the save button of the module configuration (BTW: I have tested it with addHookBefore and addHookAfter and also with Tracy bd() calls).

I am not sure that this issue is since the ProcessWire 3.0.219 but I have discovered the issue there and this hook has worked in the past.

Does someone discover the same issue or has an idea, what a possible reason could be?

Thanks in advance

Link to comment
Share on other sites

  • Juergen changed the title to Modules::saveConfig Hook does not fire anymore [SOLVED]

I'm not sure this is ok, as saveModuleConfigData is: "@deprecated Please use saveConfig() method instead". saveConfig() is hookable and it should fire, so not sure what's going on. Maybe others have an idea?

Link to comment
Share on other sites

  • Juergen changed the title to Modules::saveConfig Hook does not fire anymore

@Juergen I'm updating this in wire/core/Modules.php:

    public function ___saveModuleConfigData($className, array $configData) {
        return $this->configs->saveConfig($className, $configData);
    }

to this:

    public function ___saveModuleConfigData($className, array $configData) {
        return $this->saveConfig($className, $configData);
    }

I think that'll fix it, though let me know if you find it still doesn't work. Thanks.

 

  • Like 2
Link to comment
Share on other sites

  • Juergen changed the title to Modules::saveConfig Hook does not fire anymore [SOLVED]

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
 Share

  • Recently Browsing   0 members

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