本文整理汇总了PHP中Pagekit\Application::on方法的典型用法代码示例。如果您正苦于以下问题:PHP Application::on方法的具体用法?PHP Application::on怎么用?PHP Application::on使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pagekit\Application
的用法示例。
在下文中一共展示了Application::on方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prepareView
/**
* 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);
}
});
}
示例2: main
/**
* {@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());
});
}
示例3: main
/**
* {@inheritdoc}
*/
public function main(App $app)
{
$app->on('boot', function () use($app) {
$this->framework = $app->module('bixie/pk-framework');
});
$app->subscribe(new FormmakerPlugin());
}
示例4: main
/**
* {@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));
});
});
}
示例5: prepareView
/**
* 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']);
});
}
示例6: main
/**
* {@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());
}
示例7: main
/**
* {@inheritdoc}
*/
public function main(App $app)
{
$app->on('boot', function () {
$this->framework = App::module('bixie/pk-framework');
});
}
示例8: clearCache
/**
* Clear cache on terminate event.
*/
public function clearCache(array $options = [])
{
App::on('terminate', function () use($options) {
$this->doClearCache($options);
}, -512);
}