Ejemplo n.º 1
0
 /**
  * Prepare form for display
  * @param App $app
  * @param \Bixie\Formmaker\FormmakerModule $formmaker
  */
 public function prepareView($app, $formmaker)
 {
     if ($this->get('recaptcha') && $formmaker->config('recaptha_secret_key')) {
         $app->on('view.footer', function ($event) {
             $event->addResult('<script src="https://www.google.com/recaptcha/api.js?onload=grecacapthaCallback&render=explicit" async defer></script>');
         });
     }
     $app->on('view.styles', function ($event, $styles) use($formmaker) {
         foreach ($this->getFields() as $field) {
             $formmaker->getFieldType($field->type)->addStyles($styles);
         }
     });
 }
 /**
  * {@inheritdoc}
  */
 public function main(App $app)
 {
     $app->on('boot', function () use($app) {
         $this->framework = $app->module('bixie/pk-framework');
         $app->subscribe(new RouteListener(), new UserListener());
     });
 }
Ejemplo n.º 3
0
 /**
  * {@inheritdoc}
  */
 public function main(App $app)
 {
     $app->on('boot', function () use($app) {
         $this->framework = $app->module('bixie/pk-framework');
     });
     $app->subscribe(new FormmakerPlugin());
 }
Ejemplo n.º 4
0
 /**
  * {@inheritdoc}
  */
 public function main(App $app)
 {
     $app['filter']->register('filesize', 'Bixie\\Framework\\Filter\\FileSizeFilter');
     $app->on('boot', function ($event, $app) {
         $app->extend('view', function ($view) use($app) {
             return $view->addHelper(new ImageHelper($app));
         });
     });
 }
Ejemplo n.º 5
0
 /**
  * Prepare form for display
  * @param App $app
  * @param \Bixie\Formmaker\FormmakerModule $formmaker
  */
 public function prepareView($app, $formmaker)
 {
     $form = $this;
     if ($this->get('recaptcha') && $formmaker->config('recaptha_secret_key')) {
         $app->on('view.footer', function ($event) {
             $event->addResult('<script src="https://www.google.com/recaptcha/api.js?onload=grecacapthaCallback&render=explicit" async defer></script>');
         });
     }
     $app->on('view.styles', function ($event, $styles) use($formmaker) {
         foreach ($this->getFields() as $field) {
             $formmaker->getFieldType($field->type)->addStyles($styles);
         }
     });
     $app->on('view.data', function ($event, $data) use($form, $formmaker) {
         $data->add('$formmaker', ['config' => $formmaker->publicConfig(), 'formitem' => $form, 'submission' => Submission::initData($form), 'fields' => array_values($form->getFields())]);
         $data->add('$fieldtypes', ['ajax_url' => 'api/formmaker/submission/ajax']);
     });
 }
Ejemplo n.º 6
0
 /**
  * {@inheritdoc}
  */
 public function main(App $app)
 {
     if (!in_array('bixie/framework', App::system()->config('extensions'))) {
         throw new \RuntimeException('Bixie Framework required for Formmaker');
     }
     $app->on('boot', function () {
         $this->framework = App::module('bixie/framework');
     });
     $app->subscribe(new FormmakerPlugin());
 }
Ejemplo n.º 7
0
 /**
  * {@inheritdoc}
  */
 public function main(App $app)
 {
     $app->on('boot', function () {
         $this->framework = App::module('bixie/pk-framework');
     });
 }
Ejemplo n.º 8
0
 /**
  * Clear cache on terminate event.
  */
 public function clearCache(array $options = [])
 {
     App::on('terminate', function () use($options) {
         $this->doClearCache($options);
     }, -512);
 }