Hook for both shop and admin

Ask the community for help and support.
Post Reply
Piernas
Posts: 96
Joined: Thu Mar 11, 2021 2:16 am
Has thanked: 2 times
Been thanked: 4 times

Hook for both shop and admin

Post by Piernas »

Is there a way to set up a global site hook rather than copying it under hooks/admin and hooks/shop?
ecartz
Lead Developer
Lead Developer
Posts: 2637
Joined: Tue Nov 05, 2019 6:02 pm
Has thanked: 4 times
Been thanked: 181 times

Re: Hook for both shop and admin

Post by ecartz »

No.
ecartz
Lead Developer
Lead Developer
Posts: 2637
Joined: Tue Nov 05, 2019 6:02 pm
Has thanked: 4 times
Been thanked: 181 times

Re: Hook for both shop and admin

Post by ecartz »

You might be able to simplify it a bit by having one file alias the other. E.g.

Code: Select all

class hook_admin_siteWide_whatever extends hook_shop_siteWide_whatever {
}
would duplicate all the listeners in the shop class into the admin class. But it would still take two files.
Piernas
Posts: 96
Joined: Thu Mar 11, 2021 2:16 am
Has thanked: 2 times
Been thanked: 4 times

Re: Hook for both shop and admin

Post by Piernas »

Thank you. It's not a real problem to have two files - I was wondering if I could use just one for both.
Post Reply