Can one disable a hook?

Open to all! Ask other shopowners for help.
Post Reply
ArtcoInc
Contributor
Posts: 119
Joined: Fri Oct 25, 2019 4:19 pm
Phoenix Version: v1.0.3.0
Has thanked: 86 times
Been thanked: 17 times

Can one disable a hook?

Post by ArtcoInc »

If a module is installed that uses a hook, can it be disabled (preferably in Admin), without actually deleting the hook (and all of the associated code)?

TIA

Malcolm


Join The Code Co-op to get access to your library in the Code Co-op Forum
azpro
Contributor
Posts: 177
Joined: Fri Nov 06, 2020 8:25 am
Phoenix Version: v1.1.0.6
Has thanked: 30 times
Been thanked: 34 times

Re: Can one disable a hook?

Post by azpro »

Yes - Possible. With Phoenix nothing is impossible! But in admin you would need Core Code adjustments - which you probably don not want.

In the hook - you can add (in the hook)
class hook_admin_siteWide_hMenu {

public $version = '1.0.0';

// DO NOT USE THIS MENU
public function listen_injectBodyStart() {
// Optie B:
return false;
}

// rest of the hook - comment out
/*
public static function sort_box_links($a, $b) {
return strcasecmp($a['title'], $b['title']);
}
*/

}
I am not sure whether it is preferable / desirable to comment out the rest of the hook. Maybe @ecartz or @burt can explain.

I am not sure - but I think better comment out


Join The Code Co-op to get access to your library in the Code Co-op Forum
Post Reply