-
-
Notifications
You must be signed in to change notification settings - Fork 825
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Container - Use ClassScanner to setup HookListeners. Add test.
Before: While setting up the container-cache, it scans for these patterns: * BAOs implementing HookInterface * BAOs implementing EventDispatcherInterface After: While setting up the container-cache, it scans for these patterns: * BAOs implementing HookInterface (*unchanged*) * BAOs implementing EventDispatcherInterface (*unchanged*) * Extensions for classes (./Civi and ./CRM) implementing HookInterface (*new*) Comment: For the moment, the `EventDispatcherInterface` is not (on its own) sufficient to activate auto-registration. This is because (1) the interface is quite common in the world-at-large, so we'd prone to over-listening and (2) we don't control the versioning-cycle, so the dephell is likely worse. However, if you really want it, I think that it will pick up classes that implement both `HookInterface` and `EventDispatcherInterface`.
- Loading branch information
Showing
4 changed files
with
41 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
class CRM_Shimmy_ShimmyHooks implements \Civi\Core\HookInterface { | ||
|
||
public static function hook_civicrm_shimmyFooBar(array &$data, string $for): void { | ||
$data[] = "hello $for"; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters