本文整理匯總了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);
}