本文整理汇总了PHP中app::languages方法的典型用法代码示例。如果您正苦于以下问题:PHP app::languages方法的具体用法?PHP app::languages怎么用?PHP app::languages使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app
的用法示例。
在下文中一共展示了app::languages方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
if (app::$site->users()->count() > 0) {
go('panel/login');
}
if ($problems = installation::check()) {
$content = view('installation/check', array('problems' => $problems));
} else {
$form = app::form('installation', array('language' => c::get('panel.language', 'en')));
$form->cancel = false;
$form->save = l::get('installation.signup.button');
$form->centered = true;
foreach (app::languages() as $lang) {
$form->fields()->get('language')->options[$lang->code()] = $lang->title();
}
$form->on('submit', function ($form) {
try {
app::$site->users()->create($form->serialize());
go('panel/login/welcome');
} catch (Exception $e) {
$form->alert($e->getMessage());
}
});
$content = view('installation/signup', array('form' => $form));
}
return layout('installation', array('meta' => new Snippet('meta'), 'content' => $content));
}
示例2: form
protected function form($user = null)
{
$mode = $user ? 'edit' : 'add';
$fields = data::read(root('panel.app') . DS . 'forms' . DS . 'user.' . $mode . '.php', 'yaml');
$content = $user ? $user->data() : array();
// add all languages
$fields['language']['options'] = array();
$fields['language']['default'] = c::get('panel.language', 'en');
foreach (app::languages() as $code => $lang) {
$fields['language']['options'][$code] = $lang->title();
}
// make sure the password is never shown in the form
unset($content['password']);
return new Form($fields, $content);
}