4

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?

1 Answer 1

2

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
        )
)
0

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.