【问题标题】:Drupal custom theme info.yml files crashes siteDrupal 自定义主题 info.yml 文件崩溃站点
【发布时间】:2021-09-24 21:04:39
【问题描述】:

我正在探索 Drupal 9 中的自定义主题。我正在使用 MAMP 和全新的本地安装 Drupal。我在网上找不到以下问题的解决方案。

我在 Themes/ 中创建了 contrib 和 custom 文件夹。我可以将主题放在 contrib 文件夹中,它们会出现在 admin/appearance 中。到目前为止,正确的行为。在自定义中,我制作了 test/test.info.yml。这是代码:

name: Test
type: theme
description: 'Test theme'
core_version_requirement: ^8 || ^9

就是这样。网上的一切都说这些是基本的必需键。

当我返回管理员/外观时,网站崩溃并出现错误“网站遇到意外错误。请稍后再试。”控制台显示“GET http://localhost:8888/admin/appearance 500(500 服务不可用(带消息))”

只要我删除 test.info.yml 并刷新浏览器,admin/appearance 就会重新出现。即使将测试文件夹放入 contrib 也会导致它崩溃。我还把一个contrib模块移到custom中,只要没有test.info.yml文件就出现了。

MAMP 的 php 错误日志显示如下:“Uncaught PHP Exception Drupal\Core\Extension\InfoParserException: "Missing required key ("base theme") in theme/custom/test/test.info.yml"

一旦我添加了一个基本主题,该主题就会出现在 admin/appearance 中。

我读过的所有内容都说这四行是主题 info.yml 文件中唯一需要的内容。那么为什么我会收到这个错误?我想了解。

【问题讨论】:

  • 此外,如果基本主题键设置为与自身相同的机器名称,它将在循环中占用无限 RAM - 最近遇到此问题并在此处写下 drupal.stackexchange.com/questions/307618/… - 内存已用尽在 ThemeInitialization.php 上。

标签: php drupal drupal-theming drupal-9


【解决方案1】:

现在需要主题 .info.yml 文件中的基本主题属性。

这是link to the change record

【讨论】:

  • 感谢您的澄清
  • 这就是答案,我认为这应该被标记为答案。
猜你喜欢
  • 2023-03-26
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-07-31
  • 2016-05-03
  • 1970-01-01
相关资源
最近更新 更多