Perforce Chronicle 2012.2/486814
API Documentation
|
Module integration classes provide a place to add functionality and integrate a module with the rest of the system. More...
Static Public Member Functions | |
static | __callStatic ($name, $args) |
Automatically proxy calls for non-existant methods to the package. | |
static | disable () |
When a module is to deactivated, this method is called. | |
static | enable () |
When a module is to be activated, this method is called. | |
static | init () |
Init preceeds load. | |
static | load () |
Load follows init. |
Module integration classes provide a place to add functionality and integrate a module with the rest of the system.
To integrate a module with the system, modules may extend the Integration class and subscribe to topics via the PubSub component. For example:
P4Cms_PubSub::subscribe('p4cms.some.topic', <callback>);
When other parts of the system publish to the topic, the module's callback function will be invoked.
Third-party modules may publish additional topics to define their own integration points.
All module integration classes should be static classes whose name begins with the name of the module, followed by an underscore and the word Module (e.g. 'Foo_Module').
static P4Cms_Module_Integration::__callStatic | ( | $ | name, |
$ | args | ||
) | [static] |
Automatically proxy calls for non-existant methods to the package.
string | $name | the name of the method called. |
array | $args | the arguments to the method. |
BadMethodCallException | if the method doesn't exist. |
{ $class = get_called_class(); $module = substr($class, 0, strpos($class, '_')); if (P4Cms_Module::exists($module)) { $module = P4Cms_Module::fetch($module); if (method_exists($module, $name)) { return call_user_func_array(array($module, $name), $args); } } throw new BadMethodCallException( "Method " . $class . "::" . $name . " does not exist." ); }
static P4Cms_Module_Integration::disable | ( | ) | [static] |
When a module is to deactivated, this method is called.
Deactivation happens when a user no longer wants to use a module's services within the application.
{ }
static P4Cms_Module_Integration::enable | ( | ) | [static] |
When a module is to be activated, this method is called.
Activation happens when a module has been installed and a user now wants to use its services within the application.
{ }
static P4Cms_Module_Integration::init | ( | ) | [static] |
Init preceeds load.
This method allows the module author to participate in the module initialization process. Prior to calling this method, the package system registers the module with the various components of the application such as the autoloader, view, front-controller, etc.
This method is intended for the module author to perform additional registration operations such as subscribing to pub/sub topics. In general, the initization phase is not intended for doing actual work.
Notes:
Reimplemented in Category_Module, Content_Module, History_Module, Menu_Module, Setup_Module, Site_Module, System_Module, Ui_Module, User_Module, Widget_Module, and Workflow_Module.
{ }
static P4Cms_Module_Integration::load | ( | ) | [static] |
Load follows init.
This method allows the module author to perform additional work during bootstrap, for example publishing pub/sub topics, interacting with other modules, adding request-specific javascript to the page, etc. Unlike init, this method is intended for doing actual work.
Notes:
Reimplemented in Content_Module, Cron_Module, Error_Module, Site_Module, Ui_Module, User_Module, Widget_Module, Analytics_Module, Comment_Module, EasyCron_Module, Search_Module, and Url_Module.
{ }