summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorxue <>2005-12-19 22:39:52 +0000
committerxue <>2005-12-19 22:39:52 +0000
commit2a940b0f6ce13cb612d3db585aaaf3d49b95885a (patch)
treeb1186ab5e094e07ec04d611428dff4d617294b95 /framework
parent60aae399eb7d2878632c5629a19767124be1ff24 (diff)
Added detachEventHandler.
Diffstat (limited to 'framework')
-rw-r--r--framework/TComponent.php23
1 files changed, 23 insertions, 0 deletions
diff --git a/framework/TComponent.php b/framework/TComponent.php
index 1a4dfe6e..0282be3a 100644
--- a/framework/TComponent.php
+++ b/framework/TComponent.php
@@ -318,6 +318,29 @@ class TComponent
}
/**
+ * Detaches an existing event handler.
+ * This method is the opposite of {@link attachEventHandler}.
+ * @param string event name
+ * @param string callback the event handler to be removed
+ * @return boolean if the removal is successful
+ */
+ public function detachEventHandler($name,$handler)
+ {
+ if($this->hasEventHandler($name))
+ {
+ try
+ {
+ $this->getEventHandlers($name)->remove($handler);
+ return true;
+ }
+ catch(Exception $e)
+ {
+ }
+ }
+ return false;
+ }
+
+ /**
* Raises an event.
* This method represents the happening of an event and will
* invoke all attached event handlers for the event.