Trying something I thought would be extremely simple. Adding an ‘email’ field within the site options so a uniform contact form recipient can be controlled in the panel. Having zero luck with this.
I have the following in my page controller
<?php
use Uniform\Form;
return function ($kirby) {
$form = new Form([
'name' => [
'rules' => ['required'],
'message' => 'Please enter your full name',
],
'email' => [
'rules' => ['required', 'email'],
'message' => 'Please enter a valid email address',
],
'subject' => [
'rules' => ['required'],
'message' => 'Please enter a subject for your query',
],
'message' => [
'rules' => ['required'],
'message' => 'You forgot a query',
],
]);
if ($kirby->request()->is('POST')) {
$form->emailAction([
'to' => $kirby->site()->recipient(),
'from' => 'info@website.com',
]);
}
return compact('form');
};
Any pointers much appreciated…