6use Symfony\Component\HttpFoundation\Request;
7use Symfony\Component\HttpKernel\HttpKernelInterface;
15 $url=$router->generate($url);
16 }
catch (\Exception $e){
24 if(\array_key_exists(
"q", $view)===
false){
27 $view[
"q"][$identifier]=$content;
28 }elseif($view instanceof \Twig_Environment){
29 $vars=$view->getGlobals();
30 if(\array_key_exists(
"q", $vars)===
false){
33 $vars[
"q"][$identifier]=$content;
34 $view->addGlobal(
"q",$vars[
"q"]);
45 }elseif($view instanceof \Twig_Environment){
46 $view->addGlobal($key,$value);
57 public function forward($initialControllerInstance,$controllerName,$actionName,
$params=array()){
59 $request = $initialControllerInstance->get(
'request_stack')->getCurrentRequest();
60 $path[
'_forwarded'] = $request->attributes;
61 $path[
'_controller'] = $controllerName.
":".$actionName;
62 $subRequest = $request->duplicate([],
null, $path);
63 $response= $initialControllerInstance->get(
'http_kernel')->handle($subRequest, HttpKernelInterface::SUB_REQUEST);
64 return $response->getContent();
68 if ($initialControllerInstance->has(
'templating')) {
69 return $initialControllerInstance->get(
'templating')->render($viewName,
$params);
72 if (!$initialControllerInstance->has(
'twig')) {
73 throw new \LogicException(
'You can not use the "renderView" method if the Templating Component or the Twig Bundle are not available.');
76 return $initialControllerInstance->get(
'twig')->render($viewName,
$params);
80 $request = $dispatcher->get(
'request_stack')->getCurrentRequest();
81 $uri=$request->getPathInfo();
82 if(JString::startswith($uri,
"/")){
83 $uri=\substr($uri, 1);
85 return \explode(
"/", $uri);
fromDispatcher($dispatcher)
Collects url parts from the request dispatcher : controllerName, actionName, parameters Used internal...
getUrl($url)
Generates an URL Used internally by phpMv.
renderContent($initialControllerInstance, $viewName, $params=NULL)
render the content of an existing view : $viewName and set the response to the modal content Used int...
createScriptVariable(&$view, $view_var, $output)
Creates the script variable script_foot Used internally by phpMv.
addVariable($key, $value, &$view)
forward($initialControllerInstance, $controllerName, $actionName, $params=array())
addViewElement($identifier, $content, &$view)
Adds the array of controls q in the $view element Used internally by phpMv.