Update to Uniform v3
This commit is contained in:
@@ -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');
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user