定制 wordpress-gcb/fields 二次开发

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

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

wordpress-gcb/fields

Composer 安装命令:

composer require wordpress-gcb/fields

包简介

Turn a GCB block.fields.json controls schema into a WordPress block attribute schema — the PHP companion to @wordpress-gcb/fields, usable without the GCB plugin.

README 文档

README

Turn a GCB block.fields.json controls schema into a WordPress block attribute schema, in PHP, with no dependency on the GCB plugin. The server-side companion to @wordpress-gcb/fields (npm).

Part of GCB — Gutenberg Control Blocks.

Install

composer require wordpress-gcb/fields

Usage

use GCBFields\Schema;

$controls = json_decode(
    file_get_contents( __DIR__ . '/blocks/hero/block.fields.json' ),
    true
)['controls'];

register_block_type( __DIR__ . '/blocks/hero', [
    'attributes' => Schema::attributes( $controls ),
] );

Schema::attributes() returns the { type, default } map WordPress expects — structural controls (group/panel/tools-panel) are skipped, control types map to the right attribute type, and each gets a sensible default (overridable per control via attributeType / default).

API

  • Schema::attributes(array $controls): array — full controls → attributes map.
  • Schema::attribute_type(string $controlType): string — one control type → string|number|boolean|array|object.
  • Schema::default_value(string $attributeType): mixed — the empty default for a type.

Links

License

GPL-2.0-or-later

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: GPL-2.0-or-later
  • 更新时间: 2026-06-05

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固