本文整理汇总了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());
}