foadyousefi/seven-fields 问题修复 & 功能扩展

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

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

foadyousefi/seven-fields

Composer 安装命令:

composer require foadyousefi/seven-fields

包简介

WordPress developer-friendly option pages with custom fields.

README 文档

README

About

For one of my projects that needs some settings, I searched to find a library who does this for me. I found Carbon Fields, its nice and relativaly easy to use and most important, could be installed via composer.

But it has its limitations. Non of the fields types had description (at least when I used it). Also the function for retriving options valie from database, is loading after init action, but what if I need to access data before init? Well, I need to write my function. And also field types was a bit limited.

So decided to write my own and after finishing, thought why not to open source it so other can benifit.

Supported Fields

  • Checkbox
  • Header
  • Raw html
  • Multiselect
  • Select
  • Textfield
  • Password
  • Textarea

More fields will be added later, but til them, don't hesitate to ask for features and more fields by opening new issue.

How to use?

1- In your plugin or theme directory, run composer require foadyousefi/seven-fields

2- In your functions.php or your plugin write:

use SevenFields\Fields\Fields;
use SevenFields\Container\Container;

add_action( 'admin_menu', 'setting_pages_init' );
function setting_pages_init() {
    Container::make( 'Menu title', 'menu-slug' )
    ->add_fields( 'add_fields_to_the_page' );
}

function add_fields_to_the_page() {
    Fields::add('header', null, 'This is header' );
    Fields::add('text', 'example_text_field', 'This is text field', 'And this is description' );
    Fields::add('password', 'example_password_field', 'This is password field', 'And this is description' );
    Fields::add( 'checkbox', 'example_checkbox', 'Checkbox label', 'And description' );
    Fields::add( 'textarea', 'example_text_area', 'Textarea example',  'And description. <be />New line in description with <b>bold</b> text.' );

  }

How to read options?

To read options from database, you can somply use wordpress get_option() function by passing the optoin name and optional default value. like so:

get_option( 'example_text_field', 'lorem ipsum' )

I will try to update README and describe all possible options.

foadyousefi/seven-fields 适用场景与选型建议

foadyousefi/seven-fields 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 58 次下载、GitHub Stars 达 1, 最近一次更新时间为 2018 年 09 月 20 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 foadyousefi/seven-fields 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 foadyousefi/seven-fields 我们能提供哪些服务?
定制开发 / 二次开发

基于 foadyousefi/seven-fields 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: GPL-2.0
  • 更新时间: 2018-09-20