Update to Uniform v3

This commit is contained in:
2017-06-04 22:07:34 +02:00
parent 82134a91b5
commit 6592193ed4
9 changed files with 65 additions and 30 deletions
+23 -13
View File
@@ -1,21 +1,31 @@
<?php
use Uniform\Form;
return function($site, $pages, $page) {
$form = uniform('contact', [
'required' => [
'name' => '',
'_from' => 'email'
$form = new Form([
'name' => [
'rules' => ['required'],
'message' => l::get('contact.message.name-invalid', 'Please enter your name.')
],
'actions' => [
[
'_action' => 'email',
'to' => qdated(),
'sender' => 'codesignd form <no-reply@codesignd.de>',
'subject' => 'Message from the contact form (' . $site->title() . ')',
'snippet' => 'email-templates/contact'
]
]
'email' => [
'rules' => ['required', 'email'],
'message' => l::get('contact.message.email-invalid', 'Please enter a valid email address.')
],
'message' => []
]);
// Disable some Uniform features
$form->withoutRedirect()->withoutFlashing();
if(r::is('POST')) {
$form->emailAction([
'to' => qdated(),
'from' => 'codesignd form <no-reply@codesignd.de>',
'subject' => 'Message from the contact form (' . $site->title() . ')',
'snippet' => 'email-templates/contact'
]);
}
return compact('form');
};