定制 mzur/kirby-uniform 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mzur/kirby-uniform

最新稳定版本:v5.7.0

Composer 安装命令:

composer require mzur/kirby-uniform

包简介

A versatile Kirby plugin to handle web form actions.

关键字:

README 文档

README

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' => 'me@example.com',
         'from' => 'info@example.com',
      ])->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.

统计信息

  • 总下载量: 64k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 258
  • 点击次数: 1
  • 依赖项目数: 10
  • 推荐数: 1

GitHub 信息

  • Stars: 258
  • Watchers: 9
  • Forks: 38
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-12-26