pinkcrab/form_fields 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

pinkcrab/form_fields

Composer 安装命令:

composer require pinkcrab/form_fields

包简介

A simple form field creator ideal for wp-admin hook calls where a simple input is needed only as html.

README 文档

README

alt text Open Source Love codecov

A simple way of parsing html5 form elements. Not a comprensive package, just enough to render most fields in wp-admin.

Installation

To install from composer please run

composer require pinkcrab/form_fields

Basic Usage

To create a simple form field and render(print) it to the screen

Input_Text::create( 'my_input' )
    ->current( get_option( 'my_option', 'fallback' ) )
    ->render();

You can return the HTML string of the input using as_string()

Input_Text::create( 'my_input' )
    ->current( MyData::getOption( 'my_option', 'fallback' ) )
    ->as_string();

Field Types

  • Text
  • Search
  • Password
  • Email
  • URL
  • Tel
  • Number
  • Range
  • Text Area
  • Date
  • Date Time
  • Checkbox (Single & Group)
  • Radio
  • Select
  • Raw HTML
  • Hidden
  • Week
  • Month
  • Image (button)
  • Submit

All inputs are extended from the Abstract_Field class and have all the functionality laid out in the Base Field section.

Labels

Output

Each form field is preloaded with a parser which can either render the input field or return the HTML. If you create your own field, you can make use of our existing parsers or create your own, using the Parser interface.

Input_Text::create('test')->render()    // Prints the input
Input_Text::create('test')->as_string() // Returns as HTML string.

Field Creation

All of our Form Fields has protected __construct'ors and need to be created using the create() named constructor.

Input_Text::create('name')->render();
Input_Email::create('email')->render();
Input_Password::create('password')->render();

Version

Release 0.1.7

Change Log

  • 0.1.8 - Label is now auto shown if length is above 0 and hidden if 0.
  • 0.1.7 - Added in missing URL field, also all tests cleaned up and all attributes are now just controlled by attributes, not custom properties. Added in the Datalist attribute to all valid input fields. Tests extended running over 1500 assertions
  • 0.1.6 - Added in missing fields [ Colour(inc alias Color), Week, Time, Month, File, Image, Submit & Tel ] and moved to a new abstract INPUT which is used to extend all <INPUT> fields from a base abstract input. Tests cleaned up and all attributes are now just controlled by attributes, not custom properties.
  • 0.1.5 - Allow numerical strings for select options.
  • 0.1.4 - Removed default as not implemented and not really suitable for this library. Also included the option to set custom name attributes to fields, falling back to the key (id) if not set.
  • 0.1.3 - Added in the Checkbox Group field
  • 0.1.2 - Various bug fixes
  • 0.1.1 - Various bug fixes

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-01-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固