本文整理汇总了PHP中ComponentCollection::trigger方法的典型用法代码示例。如果您正苦于以下问题:PHP ComponentCollection::trigger方法的具体用法?PHP ComponentCollection::trigger怎么用?PHP ComponentCollection::trigger使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ComponentCollection
的用法示例。
在下文中一共展示了ComponentCollection::trigger方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
/**
* Instantiates the correct view class, hands it its data, and uses it to render the view output.
*
* @param string $view View to use for rendering
* @param string $layout Layout to use
* @return CakeResponse A response object containing the rendered view.
* @link http://book.cakephp.org/2.0/en/controllers.html#Controller::render
*/
public function render($view = null, $layout = null)
{
$this->beforeRender();
$this->Components->trigger('beforeRender', array(&$this));
$viewClass = $this->viewClass;
if ($this->viewClass != 'View') {
list($plugin, $viewClass) = pluginSplit($viewClass, true);
$viewClass = $viewClass . 'View';
App::uses($viewClass, $plugin . 'View');
}
$View = new $viewClass($this);
if (!empty($this->uses)) {
foreach ($this->uses as $model) {
list($plugin, $className) = pluginSplit($model);
$this->request->params['models'][$className] = compact('plugin', 'className');
}
}
if (!empty($this->modelClass) && ($this->uses === false || $this->uses === array())) {
$this->request->params['models'][$this->modelClass] = array('plugin' => $this->plugin, 'className' => $this->modelClass);
}
$models = ClassRegistry::keys();
foreach ($models as $currentModel) {
$currentObject = ClassRegistry::getObject($currentModel);
if (is_a($currentObject, 'Model')) {
$className = get_class($currentObject);
list($plugin) = pluginSplit(App::location($className));
$this->request->params['models'][$currentObject->alias] = compact('plugin', 'className');
$View->validationErrors[$currentObject->alias] =& $currentObject->validationErrors;
}
}
$this->autoRender = false;
$this->View = $View;
$this->response->body($View->render($view, $layout));
return $this->response;
}