It has some documentation inside the files, but here's a short manual:
in the code at the place where you'd want some code to hook in (called an "entry point"):
- Create a WEnvironment and set the desired variables.
- set the entry point: Yii::app()->hookManager->entryPoint('EntryPointName', $environment)
A hook function can be a php callback of the forms:
- CMyClass::staticMethod($environment);
- callbackFunc($environment);
- WMyHook (= a class which extends WHook);
A hook can be registered with:
- at runtime: Yii::app()->hookManager->registerHook($hook, $save); // set $save to true to save in the config file
// and never need to call this function again.
- in the config file at protected/config/hooks.php
see the code for details about this.
Just copy these files to a place where they can be automatically loaded, like protected/components
Could or should this be part of the core framework?
Leave your thoughts about this below.
If you people think this should become an enhancement to the framework I'll create a ticket on google projects.
Attached File(s)
-
WHookManager.php (6.28K)
Number of downloads: 28 -
IHook.php (611bytes)
Number of downloads: 18 -
WEnvironment.php (1.39K)
Number of downloads: 15 -
WHook.php (1.08K)
Number of downloads: 15

Help

















