定制 ouun/kirki-module-sync_controls 二次开发

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

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

ouun/kirki-module-sync_controls

Composer 安装命令:

composer require ouun/kirki-module-sync_controls

包简介

Sync Module for the Kirki WordPress plugin.

README 文档

README

This module allows setting a master to a control. Let's say you add a color control which should have the same value as its master until the user decides to overwrite it. That is basically what this is all about.

Requirements

  • Kirki Framework >=4.0
  • WordPress >= 4.6

Which controls are supported

So far this is tested with the following Kirki Controls and should work with others out of the box, too:

How to set up Syncs

In general multiple controls can have the same "master". Just define sync-master within the input_attrs argument for each of them:

'input_attrs' => [
  'sync-master' => 'primary_color'
 ]

For the example above primary_color is the masters setting ID.

Special Case: Multicolor Field

Usage with: https://github.com/kirki-framework/field-multicolor

The Kirki Multicolor Field internally sets up multiple controls. It is up to you to set up a master for all colors at once or individually.

Set master for all color controls

You can do the above example for a Multicolor Field as well. So each color control of that will be synced to the master primary_color until its value is overwritten.

'input_attrs' => [
  'sync-master' => 'primary_color'
 ]

Set individual masters

Let's say you have set up the color controls like this:

'choices'   => [
  'color_1'   => esc_attr__( 'First Color', 'example' ),
  'color_2'   => esc_attr__( 'Second Color', 'example' ),
  'color_3'   => esc_attr__( 'Another Color', 'example' ),
],

So you can define for each choices individually which the sync master is.

'input_attrs' => [
  '{{ CHOICE ID }}' => [
    'sync-master' => '{{ MASTER ID }}',
  ],
  'color_2' => [
    'sync-master' => 'colors[primary]',
  ],
  'color_3' => [
    'sync-master' => 'colors[secondary]',
  ],
],

You could even define the master for all and make an exception for color_2.

'input_attrs' => [
  'sync-master' => 'colors[primary]',
  'color_2' => [
    'sync-master' => 'colors[secondary]',
  ],
],

color_1 and color_3 will have the same master colors[primary]. color_2 will be synced with colors[secondary].

Special Case: Typography Field

Usage with: https://github.com/kirki-framework/field-typography

The Typography Field is setting up multiple controls, too:

  • 'font-family'
  • 'font-weight'
  • 'font-style'
  • 'font-size'
  • 'line-height'
  • 'letter-spacing'
  • 'word-spacing'
  • 'text-transform'
  • 'text-align'
  • 'margin-top'
  • 'margin-bottom'
  • 'color'

Currently you need to define each control you want to sync individually:

'input_attrs' => [
  'font-family' => [
    'data-sync-master' => 'another_typo_control[font-family]',
  ],
  'font-weight' => [
    'data-sync-master' => 'another_typo_control[font-weight]',
  ],
],

Sync indicator

Controls which have a master sync defined have an indicator appended to the label. It is linked to focus the master control on a click and either labels AUTO as long as it is in sync or 'CUSTOM' if the value is overwritten.

ouun/kirki-module-sync_controls 适用场景与选型建议

ouun/kirki-module-sync_controls 是一款 基于 JavaScript 开发的 Composer 扩展包,目前已累计 1.07k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2020 年 04 月 07 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「framework」 「wordpress」 「customizer」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

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

围绕 ouun/kirki-module-sync_controls 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-04-07