定制 wieni/wmsettings 二次开发

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

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

wieni/wmsettings

Composer 安装命令:

composer require wieni/wmsettings

包简介

Provides an Editor UI and Developer API for managing custom settings

README 文档

README

Latest Stable Version Total Downloads License

Provides an Editor UI and Developer API for managing custom settings

Why?

Provides an Editor UI and Developers API for setting/getting content that needs to be all over the place but isn't exactly config, and isn't exactly entity stuff.

How does it work?

Technically you create config keys (eg global or site-settings). This key gets linked directly to exactly one bundle in the settings entity type.

Developers are free to create bundles/fields in the entity type settings themselves, and create keys to refer to them.

Adding configs

On /admin/config/wmsettings one can add settings. A setting effectively links a machine name to a specific entity id. The entity gets autocreated.

You can also add configs by directly writing config files I suppose, for the brave that feel up to it. Just follow the wmsettings.schema.yml for that.

Editor UI

The administrative interface for editors is at admin/content/wmsettings. Note that:

  • The administer wmsettings content permission + edit permissions for the settings entity type will be required to edit the settings
  • Editors should only be able to edit these autocreated entities. Do NOT provide direct access to creation/deletion of settings entitites.

Developers API

There are several ways to access the entity for a key.

1. The service.

$entity = Drupal::service('wmsettings.settings')
    ->read('my_key');

2. The module function.

wmsettings_get('my_key');

3. The fill function.

Returns a quick flattened array of all values in a setting, given field names and field types. Not a lot of field types are supported now.

$variables['copy'] = Drupal::service('wmsettings.settings')
    ->fill($global_copy, ['field_name' => 'textarea']);

Adding Tabs (local tasks) to settings for your custom routes

Drupal requires at least two tasks to show them, so for the sake of completeness this example loads two tasks too:

wmcustom.home_controller_home.home:
    title: 'View'
    route_name: wmcustom.home_controller_home
    base_route: wmcustom.home_controller_home
  
wmcustom.home_controller_home.edit:
    title: 'Edit'
    route_name: wmsettings.settings.redirect
    route_parameters:
        key:  'homepage'
        anchor: 'edit-group-hero-image'
        destination: 'wmcustom.home_controller_home'
    base_route: wmcustom.home_controller_home

Changelog

All notable changes to this project will be documented in the CHANGELOG file.

Security

If you discover any security-related issues, please email security@wieni.be instead of using the issue tracker.

License

Distributed under the MIT License. See the LICENSE file for more information.

wieni/wmsettings 适用场景与选型建议

wieni/wmsettings 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 28.25k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2016 年 09 月 30 日, 在 PHP 生态内属于活跃度较高的组件。

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

围绕 wieni/wmsettings 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-09-30