-
-
Notifications
You must be signed in to change notification settings - Fork 814
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CiviEventInspector - Add util for displaying hook metadata #10161
CiviEventInspector - Add util for displaying hook metadata #10161
Conversation
On second thought, if the event dispatcher is the canonical representation of hooks, then perhaps I should rename it to |
@xurizaemon @JohnFF I've updated this to report all events, including both hooks and oddballs. To get a list of hooks, you could run:
|
This will make the function more useful for the hook inspector.
This is meant to facilitate better code-generators and documentation-generators. Key features: * Adds a new class, `CRM_Utils_Hook_Inspector`. * Adds a new hook, `hook_civicrm_hooks`. Extensions may use this to document their hooks. * Implements the hook in core (to report on `civicrm-core` hooks) * If you follow the practice of declaring static hook stubs (like `civicrm-core` does), then use `addStaticStubs()` to assimilate of them.
Events are a superset of hooks.
CRM/Admin/Page/APIExplorer.php
Outdated
// Get rid of comment stars | ||
$text = str_replace(array("\n * ", "\n *\n", "\n */\n", "/**\n"), array("\n", "\n\n", '', ''), $text); | ||
$text = str_replace(array("\n * ", "\n * ", "\n *\n", "\n */\n", "/**\n"), array("\n", "\n\n", '', ''), $text); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, that last bit's a mistake. I'll squash it out.
87864c1
to
513d9c2
Compare
Use \Civi\Core\CiviEventInspector() to identify events, hooks. This is based on civicrm/civicrm-core#10161 which is WIP currently. Refs #6, #8. Refs civicrm/civicrm-core#10161.
@xurizaemon this is out of WIP now & you seem to have some familiarity with it - it looks OK to me - can you confirm you think it is good to merge? |
It seems like it will be relatively safe since nothing of significance is using it. ShowAllTheHooks is using it (see prev commit from fuzionnz/contrib.showallthehooks) but that's hardly an extensive test ... it does work, and it gives an interface that informs for available hooks and events, which is great. |
I think given the scope of this I agree with @xurizaemon and am good to merge |
This is meant to facilitate better code-generators and documentation-generators. Key features:
Civi\Core\CiviEventInspector
.hook_civicrm_eventDefs
. Extensions may use this to document their hooks.civicrm-core
hooks and events)civicrm-core
does), then useaddStaticStubs()
to assimilate of them.(Description updated to reflect current class/hook names.)