Actions

API16

JObservable/detach

From Joomla! Documentation

< API16:JObservable
Revision as of 17:37, 22 March 2010 by Doxiki (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Replacement filing cabinet.png
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

Detach an observer object

[Edit Descripton]

Description:JObservable/detach

Syntax

detach($observer)
Parameter Name Default Value Description
$observer $observer An observer object to detach

Returns

boolean True if the observer object was detached

Defined in

libraries/joomla/base/observable.php

Importing

jimport( 'joomla.base.observable' );

Source Body

public function detach($observer)
{
        // Initialise variables.
        $retval = false;
 
        $key = array_search($observer, $this->_observers);
 
        if ($key !== false)
        {
                unset($this->_observers[$key]);
                $retval = true;
                foreach($this->_methods AS &$method) {
                        $k = array_search($key, $method);
                        if ($k !== false) {
                                unset($method[$k]);
                        }
                }
        }
        return $retval;
}

[Edit See Also] SeeAlso:JObservable/detach

Examples

<CodeExamplesForm />