API16

JObservable/detach

< API16:JObservable

The "API16" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.

Description

Detach an observer object



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;
}



Examples

Code Examples


Advertisement