/** * Evaluates and returns a component. * The syntax is similar to the one of include_component. * * <b>Example:</b> * <code> * echo get_component('mymodule', 'mypartial', array('myvar' => 12345)); * </code> * * @param string $moduleName module name * @param string $componentName component name * @param array $vars variables to be made accessible to the component * * @return string result of the component execution * @see include_component */ function get_component($moduleName, $componentName, $vars = array()) { $context = sfContext::getInstance(); $actionName = '_' . $componentName; $allVars = _call_component($moduleName, $componentName, $vars); if (!is_null($allVars)) { // render $view = new sfPartialView($context, $moduleName, $actionName, ''); $view->setPartialVars($vars); $view->getAttributeHolder()->add($allVars); return $view->render(); } }
/** * Evaluates and returns a component. * The syntax is similar to the one of include_component. * * <b>Example:</b> * <code> * echo get_component('mymodule', 'mypartial', array('myvar' => 12345)); * </code> * * @param string $moduleName module name * @param string $componentName component name * @param array $vars variables to be made accessible to the component * * @return string result of the component execution * @see include_component */ function get_component($moduleName, $componentName, $vars = array()) { $context = sfContext::getInstance(); $actionName = '_' . $componentName; $config = sfConfig::get('mod_' . $moduleName . '_partial_view_class'); if (empty($config)) { require sfContext::getInstance()->getConfigCache()->checkConfig('modules/' . $moduleName . '/config/module.yml', true); $config = sfConfig::get('mod_' . $moduleName . '_partial_view_class', 'sf'); } $class = $config . 'PartialView'; $view = new $class($context, $moduleName, $actionName, ''); $view->setPartialVars($vars); if ($retval = $view->getCache()) { return $retval; } $allVars = _call_component($moduleName, $componentName, $vars); if (!is_null($allVars)) { // render $view->getAttributeHolder()->add($allVars); return $view->render(); } }
/** * Evaluates and returns a component. * The syntax is similar to the one of include_component. * * <b>Example:</b> * <code> * echo get_component('mymodule', 'mypartial', array('myvar' => 12345)); * </code> * * @param string $moduleName module name * @param string $componentName component name * @param array $vars variables to be made accessible to the component * * @return string result of the component execution * @see include_component */ function get_component($moduleName, $componentName, $vars = array()) { $context = sfContext::getInstance(); $actionName = '_' . $componentName; $class = sfConfig::get('mod_' . strtolower($moduleName) . '_partial_view_class', 'sf') . 'PartialView'; $view = new $class($context, $moduleName, $actionName, ''); $view->setPartialVars($vars); if ($retval = $view->getCache()) { return $retval; } $allVars = _call_component($moduleName, $componentName, $vars); if (!is_null($allVars)) { // render $view->getAttributeHolder()->add($allVars); return $view->render(); } }
/** * Evaluates and returns a component. * The syntax is similar to the one of include_component. * * <b>Example:</b> * <code> * echo get_component('mymodule', 'mypartial', array('myvar' => 12345)); * </code> * * @param string $moduleName module name * @param string $componentName component name * @param array $vars variables to be made accessible to the component * * @return string result of the component execution * @see include_component */ function get_component($moduleName, $componentName, $vars = array()) { $context = sfContext::getInstance(); $actionName = '_'.$componentName; $class = sfConfig::get('mod_'.strtolower($moduleName).'_partial_view_class', 'sf').'PartialView'; $view = new $class($context, $moduleName, $actionName, ''); $view->setPartialVars(true === sfConfig::get('sf_escaping_strategy') ? sfOutputEscaper::unescape($vars) : $vars); if ($retval = $view->getCache()) { return $retval; } $allVars = _call_component($moduleName, $componentName, $vars); if (null !== $allVars) { // render $view->getAttributeHolder()->add($allVars); return $view->render(); } }
/** * Evaluates and returns a component. * The syntax is similar to the one of include_component. * * <b>Example:</b> * <code> * echo get_component('mymodule', 'mypartial', array('myvar' => 12345)); * </code> * * @param string module name * @param string component name * @param array variables to be made accessible to the component * @return string result of the component execution * @see include_component */ function get_component($moduleName, $componentName, $vars = array()) { $context = coreContext::getInstance(); $actionName = '_' . $componentName; $allVars = _call_component($moduleName, $componentName, $vars); if (!is_null($allVars)) { // render $view = new coreView($context, $moduleName, $actionName, ''); // $view->getParameterHolder()->add($vars); $view->getParameterHolder()->add($allVars); return $view->render(); } }