TITAN Library for PHP5  5.6.0
Web Software Development Kit for PHP5
pluggable Class Reference

Titan Pluggable Class. More...

Public Member Functions

 __construct ($object)
 

Detailed Description

Titan Pluggable Class.

Class: \tl\core\plugin\pluggable

Author
James E. Bush work@.nosp@m.bush.nosp@m..cc
Version
5.6.0

Description:

Use this to encapsulate the object you wish to make pluggable.

The object does not need to know anything about being pluggable for this to work.

Example:

$order = new \tl\core\plugin\pluggable( new order() );

Every public method of class order will have the following hooks created:

'before_[class]_[method]' e.g. 'before_order_add_item'
'after_[class]_[method]' e.g. 'after_order_add_item'

When a method is called (e.g. $order->add_item(); ), any action hooks will be called before and after the method.


To register an action hook, simply call $mediator->add_action();

global $mediator;
$mediator->add_action('before_order_add_item', new \tl\core\loadable('', 'myaction'));

or

global $mediator;
$mediator->add_action('before_order_add_item', new \tl\core\loadable('myclass', 'myaction'));

Do not setup parameters with \tl\core\loadable, the parameters to the original method will be passed to your loadable callback.


Constructor & Destructor Documentation

__construct (   $object)

Constructor

Parameters
object$objectThe object you wish to make pluggable

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