drupal-8 - Drupal yml 安装文件
问题描述
我的模块有几个配置项,向用户实体添加一个字段并添加一个角色。两个配置都添加到 \MY_MODULE\config\install 中,安装效果很好耶!!!!!!
现在,当我卸载模块时,系统中仍然启用了字段和用户角色。这对我来说毫无意义。
有谁知道为什么或我需要做什么才能卸载它而不在 hook_uninstall 中编写代码(这就是我最终为这些字段所做的,但对我来说仍然没有意义)。
\MY_MODULE\config\install\user.role.tiimeoffadmin.yml 的内容
langcode: en
status: true
dependencies: { }
id: timeoffadministrator
label: 'Time Off Administrator'
weight: 1
is_admin: false
permissions:
- 'access comments'
- 'access content'
- 'add time off entities'
- 'edit time off entities'
- 'view published time off entities'
感谢您的任何帮助,您可以提供。
解决方案
我终于遇到了解决此问题的项目。对于 yml 文件,有需要添加的依赖项部分。因此,添加以下内容解决了我在字段和角色方面的问题。
dependencies:
module:
- timeoff
enforced:
module:
- timeoff
我将答案归功于此线程(两个人在那里发布了该解决方案@Robert Ben Parkinson 和@Ahmad)
推荐阅读
- oracle - 在 Oracle 中,如何将数据透视到多个列中?
- vbscript - 如何在 Windows 中为 VBS SAPI 语音脚本设置输出音频设备?
- javascript - 我想在我的参数编辑器中使用正则表达式来验证标志和值
- scala - 根据架构验证的结果向数据框添加列
- excel - 为什么我的工作表上的第二个 VBA 不起作用
- google-app-engine - 如何在谷歌应用引擎中查看 Spring Boot 日志
- python - 在 openCV warpPerspective 中,如何转换左侧图像并将其拼接到右侧图像?
- php - 如何通过 PHP 从 SQL 调用同一组的多个图像
- r - 通过对 2 列或更多列进行分组来计算基于日期差异的总和
- javascript - 如何停止 ParcelJS 删除构建时的 HTML 注释