2

For example, there is some module (some_module). The module contains some hook (some_module_some_hook). I need to this hook function didn't execute. For example, I'm not satisfied its code and I want to refactor it, but don't want to use patches.

Is there an opportunity to switch off this hook function (some_module_some_hook) ? For example, I want to switch it off and define in my module a new function implements this hook but having my code. How to do it in Drupal 7 ?

  • 1
    @PatrickKenny A nightmare it might indeed make, but it's definitely possible; easy, even – Clive Oct 13 '17 at 8:02
  • @Clive I learn something new every day. Wow, that's scary. – Patrick Kenny Oct 13 '17 at 8:03
3

You can implement hook_module_implements_alter(). For example to remove the cron hook from the system module:

function MYMODULE_module_implements_alter(&$implementations, $hook) {
  if ($hook == 'cron') {
    unset($implementations['system']);
  }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.