[ 'remove' => file_get_contents( __PUBLIC__.'/src/static/sub-menu-side/remove.svg' ), 'edit' => file_get_contents( __PUBLIC__.'/src/static/sub-menu-side/edit.svg' ), 'group' => file_get_contents( __PUBLIC__.'/src/static/container/group.svg' ) ], 'p_theme' => $_SESSION['WAREHOUSE']['theme'] ]; /* [3] Store functions =========================================================*/ $twig->addFunction(new \Twig_Function('f_machines', function(){ $request = new Request('machineDefault/getAll'); // On utilise la methode 'getAll' du module 'machineDefault' $answer = $request->dispatch(); // On recupere la reponse // // si erreur, on affiche rien par défaut if( $answer->error->get() != Err::Success ) return []; return $answer->get('machines'); })); $twig->addFunction(new \Twig_Function('f_clusters', function($id_machine){ $request = new Request('machineDefault/getClusters', [ 'id_machine' => (int) $id_machine ]); var_dump('r2 - machine/view.php:47', $request->error->get()); $answer = $request->dispatch(); // si erreur, on affiche rien par défaut if( $answer->error->get() != Err::Success ) return []; return $answer->get('clusters'); })); /* [4] Build the whole stuff =========================================================*/ return $twig->render('machine/view.twig', [ 'p_icon' => $variables['p_icon'], 'p_theme' => $variables['p_theme'] ]); } } ?>