Perforce Chronicle 2012.2/486814
API Documentation

P4Cms_Module_Integration Class Reference

Module integration classes provide a place to add functionality and integrate a module with the rest of the system. More...

Inheritance diagram for P4Cms_Module_Integration:
Analytics_Module Category_Module Comment_Module Content_Module Cron_Module EasyCron_Module Error_Module History_Module Menu_Module Search_Module Setup_Module Site_Module System_Module Ui_Module Url_Module User_Module Widget_Module Workflow_Module

List of all members.

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.

Detailed Description

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').

Copyright:
2011-2012 Perforce Software. All rights reserved
License:
Please see LICENSE.txt in top-level folder of this distribution.
Version:
2012.2/486814

Member Function Documentation

static P4Cms_Module_Integration::__callStatic ( name,
args 
) [static]

Automatically proxy calls for non-existant methods to the package.

Parameters:
string$namethe name of the method called.
array$argsthe arguments to the method.
Returns:
mixed the result of the method call.
Exceptions:
BadMethodCallExceptionif 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:

  • It is not safe to access other modules from init() as they are not guaranteed to be initialized yet.
  • Only core modules are initialized during setup.

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:

  • It is safe to reference other modules from load() as they are already initialized, but not necessarily 'loaded'.
  • Only a subset of core modules are loaded during setup.

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.

    {
    }

The documentation for this class was generated from the following file: