Uniform: define subject and e-mail in a page blueprint

Hi together,

I want to individualize a basic form with Uniform directly in the kirby panel. My initial thought was to simply create a page blueprint with matching fields for the subject, e-mail, etc.

This is my current try, but it doesn’t work. So I’m grateful for any help …


use Uniform\Form;

return function ($kirby,$page)
{
    $form = new Form([
      …
    ]);

    if ($kirby->request()->is('POST')) {
      $form->emailAction([
        'to' => 'info@mail.de',
        'from' => 'no-reply@mail.de',
        'replyTo' => 'no-reply@mail.de',
        'subject' => $page()->formMailSubject(),
        'template' => 'form',
      ])
      ->emailAction([
        'to' => $page()->formMailTo(),
        'from' => 'no-reply@mail.de',
        'replyTo' => 'info@mail.de',
        'subject' => $page()->formMailSubject(),
        'template' => 'form',
      ]);
    }

    return compact('form');
};

As a second step I also want to edit the e-mail massages in the panel.

Am I on the right way?

THX,
Christain

Should be $page->formMailSubject() etc. without the parenthesis. It’s a variable, not a function/method.

@pixelijn yes of course it should be like this :roll_eyes:. I didn’t see the mistake … thx a lot!