定制 jt782/require-read-terms-php 二次开发

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

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

jt782/require-read-terms-php

Composer 安装命令:

composer require jt782/require-read-terms-php

包简介

Display modal for "terms and conditions", and require user read (scroll to bottom) and agree to those terms before submitting form.

README 文档

README

Latest Version on Packagist Tests Total Downloads

Display modal for "terms and conditions", and require user read (scroll to bottom) and agree to those terms before submitting form.

Installation

You can install the package via composer:

composer require jt782/require-read-terms-php

Usage

  1. Initialize class with form target (e.g. ".class" or "#id") and terms content:
use Seven82Media\RequireReadTerms\FormTerms;

$terms = new FormTerms(
    '#target-form-id',
    '<p>terms go here</p>'
);
  1. You can modify the following values with these methods:
  • Agree Button Text: $terms->agreeButtonText("Yes, I agree!")
  • Agree Button Color: $terms->agreeButtonColor("green")
  • Cancel Button Text: $terms->cancelButtonText("NO, this is dumb!")
  • Cancel Button Color: $terms->cancelButtonColor("red")
  • Width: $terms->width("64em")
  1. Within the form, load content and display button:
$terms->loadModalDisplayButton()
  1. If you want more control of the placement of the button vs the script, you can load them separately:
  • For button display:
$terms->displayButton()
  • For script output:
$terms->loadScript()
  1. If you have a checkbox for agree to terms, you can hide it visually and have the package check it once the user has agreed to terms:
$terms->checkboxFieldTarget("#agree-to-terms");
?>
<div style="display:none;">
    <input type="checkbox" value="1" name="agreetoterms" id="agree-to-terms" />
</div>

Example

<?php
    $terms = new FormTerms('.test-form', '<p>Term content goes here</p>');
    $terms->checkboxFieldTarget("#agree-to-terms");
?>
<form class="test-form" method="get" action="/form">
    <?php
        $terms->loadModalDisplayButton();
    ?>

    <div style="display:none;">
        <input type="checkbox" value="1" name="agreetoterms" id="agree-to-terms" />
    </div>
    
    <p>
        <button type="submit">Submit</button>
    </p>
</form>

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 25
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-04-13

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固