Uniform submissions in panel

Hi everyone - I’m trying to find out information regarding having submissions via uniform show in the kirby panel. I remember seeing this somewhere a long time ago, but can’t find any info now and am unsure if it’s doable in new versions. Any pointing in the right direction appreciated!

I recently added an invoice generator to a client’s form. It’s super easy by adding a custom action:

namespace Uniform\Actions;

class CreateInvoiceAction extends Action
{
    public function perform()
    {
      try {
        kirby()->impersonate('kirby');
        $invoice = page('invoices')->createChild([
          'slug'     => 'blabla',
          'template' => 'invoice',
          'content'  => [
            'title' => 'blabla',
            'date' => date('d.m.Y'),
          ]
        ]);
        $invoice->changeStatus('listed');
      } catch (Exception $e) {
        $this->fail($e->getMessage());
      }

    }
}

Then in you controller you can simply do this:

$form->createInvoiceAction([
  // some variables you want to access via $this->requireOption('page')
  'page' => $page
]);
1 Like

Brilliant, thanks so much! Where did you find the docs on this? Assuming you had something to go off, just curious really what’s upstream.

Of course. The Uniform docs are actually really good: Actions - Kirby Uniform

Thanks, I can see where you’ve deduced it from, just wasn’t sure if somewhere explicitly covered panel stuff. Thanks so much :slight_smile:

It actually doesn’t have anything to do with the panel. I’m just creating a subpage. You can then do whatever you want with this subpage, e.g. display it in a pages section.

Alternatively you could also create structure items or blocks on every form submission. It’s totally up to you.