kerasai/drupal-config-importer
Composer 安装命令:
composer require kerasai/drupal-config-importer
包简介
Utilities for importing Drupal configuration.
README 文档
README
Utilities for importing Drupal configuration.
You may find other uses for this functionality, but it was initially developed for use in update hooks. It's generally assumed that during deployments you will want to run database updates before configuration import, because there is more flexibility in the update hooks. What this leads to is cases where a bunch of ugly code is needed to "rough-out" the necessary configuration that the update hooks depend on.
Usage
For example, you may want to populate an article_types taxonomy vocabulary automatically upon deployment. This requires creating the taxonomy vocabulary prior to the term population, if it does not already exist.
Using this config importer, doing so is as easy as the following:
Copy the taxonomy.vocabulary.article_types.yml file into the config/update/8003 folder within my_module. This allows for the vocabulary to be installed with exact/known values, not vulerable to future changes.
Then add the update hook and the population code:
function my_module_update_8003() {
$path = \Drupal::moduleHandler()->getModule('my_module')->getPath() . '/config/update/11000';
$i = Kerasai\DrupalConfigImporter\ConfigImporter::create();
$i->import('taxonomy.vocabulary.article_types', $path);
_my_module_populate_article_types();
}
function _my_module_populate_article_types() {
// Add article_types taxonomy terms here.
}
Additional functionality
To obtain an importer ready to rock and roll, simply call the Kerasai\DrupalConfigImporter\ConfigImporter::create static method. This will create an importer using the necessary Drupal services. Then you may use the ::import method to import configuration by its configuration ID (filename, minus the .yml).
The importer's ::import method has logic built-in to determine if the config being imported is a first-class ConfigEntity or general "simple" configuration. Alternatively, you may call the importer's ::importConfig or ::importConfigEntity methods.
kerasai/drupal-config-importer 适用场景与选型建议
kerasai/drupal-config-importer 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.8k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2021 年 03 月 02 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 kerasai/drupal-config-importer 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 kerasai/drupal-config-importer 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 2.8k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2021-03-02