nedsbeds / profile_split_enable
允许使用多个配置文件、CMI和配置拆分的Drupal站点为每个配置文件定义配置拆分
Requires
- drupal/config_filter: ^1.0.0
- drupal/core: ^8.6
Suggests
- drupal/config_split: ^1.0.0
This package is auto-updated.
Last update: 2024-09-11 22:38:32 UTC
README
此模块现在由Drupal.org管理 https://www.drupal.org/project/profile_split_enable
要切换,请运行 composer remove nedsbeds/profile_split_enable
和 composer require 'drupal/profile_split_enable:^2.0'
Profile Split Enable
此模块允许您从自定义Drupal安装配置文件安装Drupal,忽略默认core.extension.yml文件中设置的配置文件。
当使用config_split
时,它允许您为每个自定义安装配置文件动态启用并导入配置拆分。
简介
理论上,使用多站Drupal 8,您可能想要多个配置文件。然后,您可以从任何一个配置文件在您的多站平台上安装各种网站。更进一步,您可能想要为每个配置文件设置配置。
目前drupal/core、drupal/config_split和acquia/blt之间存在问题,这导致配置文件级别的配置拆分无法工作。
问题的本质是,配置拆分模型假设一个默认的配置集,该配置集在各个拆分中被覆盖。这对于单配置文件模型来说效果很好。然而,在多配置文件模型中,这立即崩溃,因为drupal/core将配置文件键写入core.extensions.yml。结果?当您尝试在核心extensions.yml文件中设置的活动配置文件不是core.extensions.yml中的配置文件时,您将得到以下错误
The selected installation profile <em class="placeholder">profile_1</em> does not match the profile stored in configuration <em class="placeholder">profile</em>
此模块通过在Drupal读取或写入磁盘上的core.extension文件时过滤当前配置文件名称来尝试解决这个问题,以确保当前安装的配置文件永远不会与默认配置中的配置文件冲突。
此外,如果您使用config_split
,它将在运行时启用与安装的配置文件名称匹配的拆分。这允许您为每个拆分启用特定的配置。
需求
此模块需要以下模块
- Config Filter (https://www.drupal.org/project/config_filter)
推荐模块
- Config Split (https://www.drupal.org/project/config_split): 启用后,它将允许每个配置文件有不同的配置。此模块将自动启用相关拆分
安装
此模块通过Packagist分发,因此应使用composer安装。
composer require nedsbeds/profile_split_enable ^1.0.0
-
按照通常安装贡献Drupal模块的方式安装。
请访问:https://www.drupal.org/documentation/install/modules-themes/modules-8 获取更多信息。
配置
此模块没有菜单或可修改的设置。没有配置。
为此模块正常工作,您必须将其添加到配置文件的依赖项中,然后确保它也在配置中启用(即您的core.extenstion
文件)
这是至关重要的,因为模块必须在尝试导入配置之前和之后启用。
example_profile/example_profile.info.yml
name: 'Example Profile' type: profile description: 'Example lightning sub profile.' version: 1.0.0 base profile: lightning core: 8.x dependencies: - profile_split_enable
config/default/core.extension.yml
module: ... config_filter: 0 config_split: 0 ... profile_split_enable: 0 ...
多个配置文件
对于基本功能,此模块只需要Drupal 8和config_filter
模块。启用后,它将允许您使用与默认core.extension文件中指定的不同的配置文件安装Drupal。
您可能会想使用例如 acquia/lightning
这样的配置文件,它允许您创建子配置文件(https://docs.acquia.com/lightning/subprofile)。建议您使用 acquia/blt
来设置您的 Drupal 项目,因为子配置文件目前需要修补 Drupal 核心来正常工作。
配置文件拆分
在安装了您的基配置文件后的第一次 Drupal 安装之后,启用 config_split
模块并为每个配置文件创建拆分。拆分的机器名应与配置文件的机器名匹配。
限制/待办功能
该模块目前不支持从现有配置进行安装。您应使用涉及从配置文件安装 Drupal 然后导入配置的工作流程。此工作流程是 Acquia BLT 和 Acquia ACSF 等工具采用的方法。
维护者
- Nick Downton (nedsbeds) - https://www.drupal.org/user/2720065