I have an extension that relies on certain extension hook.
The hook can be invoked either by function from EE core or third-party module.
I need to be able to tell what function / class has invoked it. Is there a way I can find that?
ExpressionEngine® Answers is a question and answer site for administrators, end users, developers and designers for ExpressionEngine® CMS. It only takes a minute to sign up.
Sign up to join this communityI have an extension that relies on certain extension hook.
The hook can be invoked either by function from EE core or third-party module.
I need to be able to tell what function / class has invoked it. Is there a way I can find that?
You should loop through the output of PHP's debug_backtrace() method.
For example, I just called it inside an extension using the channel_entries_query_result
hook (truncated a little). The object
or class
parameters would be most helpful to you to figure out which extension called the hook:
Array
(
[0] => Array
(
[function] => channel_entries_query_result
[class] => Store_ext
[object] => Store_ext Object
[type] => ->
[args] => Array
)
[1] => Array
(
[file] => /path/to/system/expressionengine/libraries/Extensions.php
[line] => 241
[function] => call_user_func_array
[args] => Array
)
[2] => Array
(
[function] => universal_call
[class] => EE_Extensions
[object] => EE_Extensions Object
[type] => ->
[args] => Array
)
[3] => Array
(
[file] => /path/to/system/expressionengine/libraries/Extensions.php
[line] => 119
[function] => call_user_func_array
[args] => Array
)
[4] => Array
(
[file] => /path/to/system/expressionengine/modules/channel/mod.channel.php
[line] => 3315
[function] => call
[class] => EE_Extensions
[object] => EE_Extensions Object
[type] => ->
[args] => Array
)
[5] => Array
(
[file] => /path/to/system/expressionengine/modules/channel/mod.channel.php
[line] => 324
[function] => parse_channel_entries
[class] => Channel
[object] => Channel Object
[type] => ->
[args] => Array
)
)