本文整理汇总了PHP中app::form方法的典型用法代码示例。如果您正苦于以下问题:PHP app::form方法的具体用法?PHP app::form怎么用?PHP app::form使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app
的用法示例。
在下文中一共展示了app::form方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add
public function add($id = '/')
{
$page = $this->page($id);
$blueprint = blueprint::find($page);
$templates = $blueprint->pages()->template();
$options = array();
$back = array('subpages' => purl('subpages/index/' . $page->id()), 'page' => purl($page, 'show'));
$form = app::form('pages.add');
$form->save = l('add');
$form->back = a::get($back, get('to'));
foreach ($templates as $template) {
$options[$template->name()] = $template->title();
}
$select = form::field('select', array('name' => 'template', 'label' => l('pages.add.template.label'), 'options' => $options, 'required' => true));
if ($templates->count() == 1) {
$select->readonly = true;
$select->value = $templates->first()->name();
}
$form->fields()->append('template', $select);
if (api::maxPages($page, $blueprint->pages()->max())) {
$form->fields = array('info' => form::field('info', array('label' => 'pages.add.error.max.headline', 'text' => 'pages.add.error.max.text')));
$form->save = false;
$form->centered = true;
}
return view('pages/add', array('page' => $page, 'form' => $form));
}
示例2: 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));
}
示例3: login
public function login($welcome = null)
{
if ($user = app::$site->user()) {
go('panel');
}
$form = app::form('login');
$form->cancel = false;
$form->save = l('login.button');
$form->centered = true;
return layout('login', array('meta' => new Snippet('meta'), 'welcome' => $welcome ? l('login.welcome') : '', 'form' => $form));
}
示例4: form
protected function form($user = null)
{
$mode = $user ? 'edit' : 'add';
return app::form('user.' . $mode);
}