<?php return function ($page) { // create the form $form = new Kirby\Panel\Form($page->getFormFields(), $page->getFormData()); // add the blueprint name as css class $form->addClass('form-blueprint-' . $page->blueprint()->name()); // center the submit button $form->centered = true; // set the keep api $form->data('keep', $page->url('keep')); // set the autofocus on the title field $form->fields->title->autofocus = true; // add the changes alert if ($page->changes()->differ()) { // display unsaved changes $alert = new Brick('div'); $alert->addClass('text'); $alert->append('<span>' . l('pages.show.changes.text') . '</span>'); $form->buttons->prepend('changes', $alert); $form->buttons->cancel->attr('href', $page->url('discard')); $form->buttons->cancel->html(l('pages.show.changes.button')); // add wide buttons $form->buttons->cancel->addClass('btn-wide'); $form->buttons->submit->addClass('btn-wide'); } else { // remove the cancel button $form->buttons->cancel = ''; } // check for untranslatable fields if (panel()->site()->language() != panel()->site()->defaultLanguage()) {
<?php return function ($page, $textarea) { $form = new Kirby\Panel\Form(array('address' => array('label' => 'editor.email.address.label', 'type' => 'email', 'placeholder' => 'editor.email.address.placeholder', 'autofocus' => 'true', 'required' => 'true'), 'text' => array('label' => 'editor.email.text.label', 'type' => 'text', 'help' => 'editor.email.text.help', 'icon' => 'font'))); $form->data('textarea', 'form-field-' . $textarea); $form->style('editor'); $form->cancel($page); return $form; };
<?php return function () { $translations = array(); foreach (panel()->translations() as $translation) { $translations[$translation->code()] = $translation->title(); } $form = new Kirby\Panel\Form(array('username' => array('label' => 'installation.signup.username.label', 'type' => 'text', 'icon' => 'user', 'placeholder' => 'installation.signup.username.placeholder', 'required' => true, 'autocomplete' => false, 'autofocus' => true), 'email' => array('label' => 'installation.signup.email.label', 'placeholder' => 'installation.signup.email.placeholder', 'type' => 'email', 'required' => true, 'autocomplete' => false), 'password' => array('label' => 'installation.signup.password.label', 'type' => 'password', 'required' => true, 'autocomplete' => false, 'suggestion' => true), 'language' => array('label' => 'installation.signup.language.label', 'type' => 'select', 'required' => true, 'autocomplete' => false, 'default' => kirby()->option('panel.language', 'en'), 'options' => $translations))); $form->attr('autocomplete', 'off'); $form->data('autosubmit', 'native'); $form->style('centered'); $form->buttons->submit->value = l('installation.signup.button'); return $form; };