1

I have one hook, "hook_form_commerce_checkout_form_alter" and that is modifying something on my checkout process. Within that though I have a switch statement that if true I want to use "hook_commerce_checkout_router" to skip the page. Is this allowed? I can't get any signs of life via DPM. I ran through a bunch of other modules and can't find anything helpful

1 Answer 1

1

Since you're already loading the form, your switch statement won't do anything. If you want to skip the page, you'll need to implement hook_commerce_checkout_router() in your module so that you can control if it shows up or not.

4
  • Ok thank you but, for all general purposes moving forward is it ok to have a hook within a hook? For example a delete hook?
    – SD Dev
    Commented Feb 18, 2016 at 14:12
  • 1
    You mean to call a hook within a module? e.g. MYMODULE_hook_something() { module_invoke_all('some_other_hook'); }
    – nvahalik
    Commented Feb 18, 2016 at 14:13
  • No let me clarify I have a module that has a hook and then within that hook it calls another hook (like a simple delete or similar)
    – SD Dev
    Commented Feb 18, 2016 at 14:15
  • 1
    It depends on what hook you're calling, but unless you are overriding a hook and you shouldn't be invoking another module's hook within your own code unless there is a darn good reason for doing so.
    – nvahalik
    Commented Feb 18, 2016 at 14:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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