• Stars
    star
    249
  • Rank 162,490 (Top 4 %)
  • Language
    PHP
  • License
    MIT License
  • Created almost 10 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A versatile Kirby plugin to handle web form actions.

Kirby Uniform

A versatile Kirby plugin to handle web form actions.

Documentation Status Tests Kirby 3

This is Uniform for Kirby 3. You can find Uniform for Kirby 2 in the kirby-2 branch.

Builtin actions:

  • Email: Send the form data by email.
  • EmailSelect: Choose from multiple recipients to send the form data by email.
  • Log: Log the form data to a file.
  • Login: Log in to the Kirby frontend.
  • SessionStore: Store the form in the user's session.
  • Upload: Handle file uploads.
  • Webhook: Send the form data as an HTTP request to a webhook.

Quick example

Controller:

<?php

use Uniform\Form;

return function ($kirby) {
   $form = new Form([
      'email' => [
         'rules' => ['required', 'email'],
         'message' => 'Email is required',
      ],
      'message' => [],
   ]);

   if ($kirby->request()->is('POST')) {
      $form->emailAction([
         'to' => '[email protected]',
         'from' => '[email protected]',
      ])->done();
   }

   return compact('form');
};

Template:

<form action="<?php echo $page->url() ?>" method="POST">
   <input name="email" type="email" value="<?php echo $form->old('email'); ?>">
   <textarea name="message"><?php echo $form->old('message'); ?></textarea>
   <?php echo csrf_field(); ?>
   <?php echo honeypot_field(); ?>
   <input type="submit" value="Submit">
</form>
<?php if ($form->success()): ?>
   Success!
<?php else: ?>
   <?php snippet('uniform/errors', ['form' => $form]); ?>
<?php endif; ?>

Installation

Install Uniform via Composer: composer require mzur/kirby-uniform

Or download the repository and extract it to site/plugins/uniform.

Setup

Add this to your CSS:

.uniform__potty {
    position: absolute;
    left: -9999px;
}

Note: Disable the Kirby cache for pages where you use Uniform to make sure the form is generated dynamically.

Documentation

For the full documentation head over to Read the Docs.

Questions

See the answers in the docs, post an issue if you think it is a bug or create a topic in the forum if you need help.

Contributing

Contributions are always welcome!

Donations

Since some people insist on sending me money for this (free) plugin you can do this here.

More Repositories

1

gnome-shell-wsmatrix

GNOME shell extension to arrange workspaces in a two-dimensional grid with workspace thumbnails
JavaScript
463
star
2

kirby-calendar-plugin

A plugin for the Kirby CMS to easily implement an event calendar.
PHP
97
star
3

watershed

A Python implementation of the watershed image segmentation algorithm
Python
78
star
4

pyJBU

A Python implementation of Joint Bilateral Upsampling
Python
38
star
5

pretty-formula

A small Java library to parse mathematical formulas to LaTeX and display them as images
Java
31
star
6

gnome-shell-always-indicator

GNOME shell extension to always show the new messages indicator on new messages
JavaScript
23
star
7

InvoiScript

Generate simple PDF invoices with PHP
PHP
17
star
8

gnome-shell-batime

GNOME shell extension to show the remaining time until fully charged/discharged instead of the battery charge in percent in the panel
JavaScript
16
star
9

laravel-openstack-swift

OpenStack Swift storage driver for Laravel/Lumen
PHP
7
star
10

eutils-pubmed-summary

A Joomla! 3 plugin for including automatically generated summaries of PubMed articles.
JavaScript
4
star
11

gulp-helpers

Gulp helper functions for a Laravel application/package which are much faster than Laravel Elixir
JavaScript
2
star
12

laravel-mix-artisan-publish

Laravel Mix plugin to run 'php artisan vendor:publish' by chaining '.publish()'
JavaScript
2
star
13

coffee-dev-grunt

A small setup for developing a CoffeeScript application with TDD
CoffeeScript
2
star
14

dkb2mt940

Convert a DKB CSV export to MT940
Python
1
star
15

sublime-text-installer

[not maintained] Source for the sublime-text-installer PPA
Shell
1
star
16

kirby-defuse-session

Allows you to to write tests for code that uses the Kirby 3 session
PHP
1
star