本文整理汇总了PHP中CComponent::detachEventHandler方法的典型用法代码示例。如果您正苦于以下问题:PHP CComponent::detachEventHandler方法的具体用法?PHP CComponent::detachEventHandler怎么用?PHP CComponent::detachEventHandler使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CComponent
的用法示例。
在下文中一共展示了CComponent::detachEventHandler方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: detach
/**
* Detaches the behavior object from the component.
* The default implementation will unset the {@link owner} property
* and detach event handlers declared in {@link events}.
* Make sure you call the parent implementation if you override this method.
* @param CComponent $owner the component that this behavior is to be detached from.
*/
public function detach($owner)
{
foreach ($this->events() as $event => $handler) {
$owner->detachEventHandler($event, array($this, $handler));
}
$this->_owner = null;
}
示例2: detach
/**
* Detaches the behavior object from the component.
* The default implementation will unset the {@link owner} property
* and detach event handlers declared in {@link events}.
* This method will also set {@link enabled} to false.
* Make sure you call the parent implementation if you override this method.
* @param CComponent $owner the component that this behavior is to be detached from.
*/
public function detach($owner)
{
foreach ($this->events() as $event => $handler) {
$owner->detachEventHandler($event, [$this, $handler]);
}
$this->_owner = null;
$this->_enabled = false;
}
示例3: attachApiRequestBehaviors
protected function attachApiRequestBehaviors(CComponent $owner)
{
$owner->attachEventHandler('onBeginRequest', array($this, 'handleSentryLogs'));
$owner->attachEventHandler('onBeginRequest', array($this, 'handleApplicationCache'));
$owner->detachEventHandler('onBeginRequest', array(Yii::app()->request, 'validateCsrfToken'));
$owner->attachEventHandler('onBeginRequest', array($this, 'handleImports'));
$owner->attachEventHandler('onBeginRequest', array($this, 'handleSetupDatabaseConnection'));
$owner->attachEventHandler('onBeginRequest', array($this, 'handleDisableGamification'));
$this->resolveBeginApiRequest($owner);
$owner->attachEventHandler('onBeginRequest', array($this, 'handleLibraryCompatibilityCheck'));
$owner->attachEventHandler('onBeginRequest', array($this, 'handleStartPerformanceClock'));
}
示例4: detachEventHandler
/**
* Dettach event hander
*
* @param string $name Event name
* @param mixed $handler Event handler
* @return bool
*/
public function detachEventHandler($name, $handler)
{
foreach (self::$_events as $index => $event) {
// when comparing 2 objects use === instead of ==
// why? http://www.richardlord.net/blog/php-nesting-level-too-deep-recursive-dependency
if ($event['name'] == $name && $event['handler'] === $handler) {
unset(self::$_events[$index]);
}
}
return parent::detachEventHandler($name, $handler);
}
示例5: detachEventHandler
/**
* Dettach event hander
*
* @param string $name Event name
* @param mixed $handler Event handler
* @return bool
*/
public function detachEventHandler($name, $handler)
{
foreach (self::$_events as $index => $event) {
if ($event['name'] == $name && $event['handler'] == $handler) {
unset(self::$_events[$index]);
}
}
return parent::detachEventHandler($name, $handler);
}