API15:JObservable/attach
From Joomla! Documentation
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.
Contents |
Description
Attach an observer object
[<! removed edit link to red link >]
<! removed transcluded page call, red link never existed >
Syntax
attach(&$observer)
| Parameter Name | Default Value | Description |
|---|---|---|
| &$observer | $observer An observer object to attach |
Returns
void
Defined in
libraries/joomla/base/observable.php
Importing
jimport( 'joomla.base.observable' );
Source Body
function attach( &$observer) { // Make sure we haven't already attached this object as an observer if (is_object($observer)) { $class = get_class($observer); foreach ($this->_observers as $check) { if (is_a($check, $class)) { return; } } $this->_observers[] =& $observer; } else { $this->_observers[] =& $observer; } }
[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >
Examples
<CodeExamplesForm />
