本文整理匯總了PHP中Dispatcher::hasListeners方法的典型用法代碼示例。如果您正苦於以下問題:PHP Dispatcher::hasListeners方法的具體用法?PHP Dispatcher::hasListeners怎麽用?PHP Dispatcher::hasListeners使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Dispatcher
的用法示例。
在下文中一共展示了Dispatcher::hasListeners方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getAuthenticationContent
/**
* Get content from listeners
*/
public function getAuthenticationContent()
{
$content = '';
if ($this->dispatcher->hasListeners(UserEvents::USER_AUTHENTICATION_CONTENT)) {
$event = new AuthenticationContentEvent($this->request);
$this->dispatcher->dispatch(UserEvents::USER_AUTHENTICATION_CONTENT, $event);
$content = $event->getContent();
// Remove post_logout session after content has been generated
$this->request->getSession()->remove('post_logout');
}
return $content;
}
示例2: isResourceActionImplemented
/**
* Returns true if the listener is implemented for a resourceType and an action
*
* @param ResourceType $resourceType
* @param string $actionName
*/
public function isResourceActionImplemented(ResourceType $resourceType = null, $actionName)
{
if ($resourceType) {
$alwaysTrue = array('rename', 'edit-properties', 'edit-rights', 'open-tracking');
//first, directories can be downloaded even if there is no listener attached to it
if ($resourceType->getName() === 'directory' && $actionName == 'download') {
return true;
}
if (in_array($actionName, $alwaysTrue)) {
return true;
}
$eventName = $actionName . '_' . $resourceType->getName();
} else {
$eventName = 'resource_action_' . $actionName;
}
return $this->dispatcher->hasListeners($eventName);
}