davidwebca/acf-block-style-location
Composer 安装命令:
composer require davidwebca/acf-block-style-location
包简介
WordPress and ACF plugin to allow a Field Group Location for every block style registered.
README 文档
README
| ‼️ | WARNING! This plugin is probably unstable since it fiddles its way around to find React instances in the page. |
|---|
Now that you've been warned: Hey, welcome! For those of you who use block styles and ACF Blocks, you probably wonder why it's not possible to register a group field for a specific block style.
The simple reason is probably because it's unreliable right now in the current Gutenberg APIs (2021-12-20), but it might change soon. In the meantime, I've hacked around this solution that 1) caches the block styles as a transient; 2) finds the ACF form React instance in the dom; 3) forces the refresh of the ACF form when we click a block style.
This is far from perfect, but if it can be of any use to someone, good!
Requirements
Installation
Install via Composer:
composer require davidwebca/acf-block-style-location
Or simply download zip of this repo and place in your plugins directory!
Setup
You'll need to first visit a Gutenberg-enabled page to prune the block styles cache. This is simply because WordPress doesn't allow fetching Block Styles on non-gutenberg pages (yet) since they can still be registered from the JavaScript API only. ACF adheres to that and only activates its block functionalities on Gutenberg-enabled pages.
Once you've done that, you can go back to the admin and fill in your Field Groups with the block location and then the block style location. Only the block style location should work though since all the block styles are namespaced.
The value to pass, for those who use PHP or ACF Builder to register their fields, is as follows:
$acfBuilder->setLocation('acf_block_style', '==', 'acf/blockname:stylename');
Example:
$acfBuilder->setLocation('acf_block_style', '==', 'acf/postlist:default'); /* Block style class is "is-style-default" */
Also possible to negate:
$acfBuilder->setLocation('acf_block_style', '!=', 'acf/postlist:default'); /* Block style class is "is-style-default" */
Bug Reports and contributions
All issues can be reported right here on github and I'll take a look at it. I don't intend on maintaining this a lot this the APIs will vastly change in the next few releases of Gutenberg, but please don't hesitate to ask around and create issues on Github. Make sure to give as many details as possible since I'm working full-time and will only look at them once in a while. Feel free to add the code yourself with a pull request.
License
This code is provided under the MIT License.
davidwebca/acf-block-style-location 适用场景与选型建议
davidwebca/acf-block-style-location 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 6 次下载、GitHub Stars 达 2, 最近一次更新时间为 2021 年 12 月 21 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「plugin」 「wordpress」 「editor」 「gutenberg」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 davidwebca/acf-block-style-location 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 davidwebca/acf-block-style-location 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 davidwebca/acf-block-style-location 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
CakePHP 4.x AdminLTE Theme.
Adds more BBCode
UEditor 是一套开源的在线HTML编辑器,主要用于让用户在网站上获得所见即所得编辑效果,开发人员可以用 UEditor 把传统的多行文本输入框(textarea)替换为可视化的富文本输入框。
Simple WYSIWYG editor plugin for Bootstrap 3
Summernote extension for laravel-admin
Silverstripe Front-End Editor. Useful for places where you have listings and users can maintain their own page.
统计信息
- 总下载量: 6
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-12-21