本文整理匯總了PHP中Cx\Core\Core\Controller\Cx::getEvents方法的典型用法代碼示例。如果您正苦於以下問題:PHP Cx::getEvents方法的具體用法?PHP Cx::getEvents怎麽用?PHP Cx::getEvents使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Cx\Core\Core\Controller\Cx
的用法示例。
在下文中一共展示了Cx::getEvents方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: loadComponent
/**
* Load a component (tell it to parse its content)
* @param string $componentName Name of component to load
*/
public function loadComponent($componentName)
{
$component = $this->findOneBy(array('name' => $componentName));
$this->cx->getEvents()->triggerEvent('preComponent', array('componentName' => $component->getName(), 'component' => $component, 'hook' => 'load'));
$component->load($this->cx->getPage());
$this->cx->getEvents()->triggerEvent('postComponent', array('componentName' => $component->getName(), 'component' => $component, 'hook' => 'load'));
}
示例2: __construct
/**
* @param $cx Cx
*
* @throws \Cx\Core\Event\Controller\EventManagerException
*/
public function __construct($cx)
{
$this->cx = $cx;
$eventHandlerInstance = $this->cx->getEvents();
/**
* Loads all mediatypes into $this->allMediaTypePaths
*/
$eventHandlerInstance->triggerEvent('mediasource.load', array($this));
ksort($this->allMediaTypePaths);
foreach ($this->allMediaTypePaths as $mediaSource) {
/**
* @var $mediaSource MediaSource
*/
if ($mediaSource->checkAccess()) {
$this->mediaTypePaths[$mediaSource->getName()] = $mediaSource->getDirectory();
$this->mediaTypes[$mediaSource->getName()] = $mediaSource;
}
}
}
示例3: postInit
/**
* PostInit hook to add entity validation
* @param \Cx\Core\Core\Controller\Cx $cx Cx class instance
*/
public function postInit(\Cx\Core\Core\Controller\Cx $cx)
{
// init cx validation
$cx->getEvents()->addEventListener('model/onFlush', new \Cx\Core\Model\Model\Event\EntityBaseEventListener());
}