Esempio n. 1
0
 /**
  * Adds the Blocklyduino-specific assets our application needs
  * @param \Twig_Environment $twig The Twig environment to add the asset paths to
  * @param Blocklyduino $app The application
  */
 static function addBlocklyduinoAssets(\Twig_Environment $twig, Blocklyduino $app)
 {
     $twig->addFunction(new \Twig_SimpleFunction('blocklyduino_lib', function ($blockly) use($app) {
         // implement whatever logic you need to determine the blocklyduino path
         return sprintf('%sblockly/apps/blocklyduino/%s', $app->url('home'), ltrim($blockly, '/'));
     }));
     $twig->addFunction(new \Twig_SimpleFunction('blockly_apps_lib', function ($blockly) use($app) {
         // implement whatever logic you need to determine the blockly apps path
         return sprintf('%sblockly/apps/%s', $app->url('home'), ltrim($blockly, '/'));
     }));
     $twig->addFunction(new \Twig_SimpleFunction('blockly_lib', function ($blockly) use($app) {
         // implement whatever logic you need to determine the blockly path
         return sprintf('%sblockly/%s', $app->url('home'), ltrim($blockly, '/'));
     }));
 }
Esempio n. 2
0
 /**
  * Adds the CRUD methods for the / route of the application
  * @param Blocklyduino $app The current application
  */
 public static function addFrameRoute(Blocklyduino $app)
 {
     $app->get('/blocklyframe', function (Blocklyduino $app) {
         return $app['twig']->render('frame.html.twig');
     })->bind('blocklyframe');
 }