如何在 Drupal 8 的 .info.yml 文件中包含 Drupal 7 属性?
How to include Drupal 7 properties in a .info.yml file for Drupal 8?
我正在将 Drupal 7 主题移植到 Drupal 8(这是将整个网站迁移过来的一部分)。我知道第一步是创建目录结构并修改 .info
文件。但是,我被困在几个地方。
我之前的 .info
文件具有以下属性:
name: Theme
type: theme
description: 'My custom theme'
core: 8.x
engine: twig
screenshot: screenshot.png
base theme: omega
regions:
page_top:
page_bottom:
content:
other stuff:
zones:
user:
branding:
header:
preface:
content:
postscript:
footer:
css:
global.css:
name:
description:
options:
weight:
stylesheets:
all:
-some css files from my cs folder
scripts:
-some scripts from my js folder
grids:
theme_default:
name:
layouts:
wide:
normal:
narrow:
columns:
full:
24:
16:
12:
settings:
a ton of settings:
version: "8.x"
core: "8.x"
project: "omega"
但是,我发现并非所有这些都是有效密钥(如 https://www.drupal.org/docs/8/theming-drupal-8/defining-a-theme-with-an-infoyml-file
中所示)。我知道 stylesheets
和 scripts
属性现在由图书馆处理,但仍然留下 zones
、css
、grids
和 settings
属性。我应该保持原样,还是有特殊的方法来处理它们?
如 Drupal 8 theme info file documentation 中所定义,主题信息文件中支持的键名是
name (required)
type (required)
description (optional)
package (optional)
core (required)
php (optional)
version (optional)
libraries (optional)
libraries-override (optional)
libraries-extend (optional)
base theme (recommended)
hidden (optional)
engine (optional)
logo (optional)
screenshot (optional)
regions (optional)
regions_hidden (optional)
features (optional)
stylesheets-remove (deprecated)
ckeditor_stylesheets (optional)
因此您的主题信息文件只能具有这些属性。其他任何内容都将被忽略。
但是,drupal 8 允许主题和模块具有任意数量的自定义配置,这些配置可以通过配置架构系统加载。您可以使用它来定义所有其他设置。您可以从以下阅读更多相关信息
我正在将 Drupal 7 主题移植到 Drupal 8(这是将整个网站迁移过来的一部分)。我知道第一步是创建目录结构并修改 .info
文件。但是,我被困在几个地方。
我之前的 .info
文件具有以下属性:
name: Theme
type: theme
description: 'My custom theme'
core: 8.x
engine: twig
screenshot: screenshot.png
base theme: omega
regions:
page_top:
page_bottom:
content:
other stuff:
zones:
user:
branding:
header:
preface:
content:
postscript:
footer:
css:
global.css:
name:
description:
options:
weight:
stylesheets:
all:
-some css files from my cs folder
scripts:
-some scripts from my js folder
grids:
theme_default:
name:
layouts:
wide:
normal:
narrow:
columns:
full:
24:
16:
12:
settings:
a ton of settings:
version: "8.x"
core: "8.x"
project: "omega"
但是,我发现并非所有这些都是有效密钥(如 https://www.drupal.org/docs/8/theming-drupal-8/defining-a-theme-with-an-infoyml-file
中所示)。我知道 stylesheets
和 scripts
属性现在由图书馆处理,但仍然留下 zones
、css
、grids
和 settings
属性。我应该保持原样,还是有特殊的方法来处理它们?
如 Drupal 8 theme info file documentation 中所定义,主题信息文件中支持的键名是
name (required)
type (required)
description (optional)
package (optional)
core (required)
php (optional)
version (optional)
libraries (optional)
libraries-override (optional)
libraries-extend (optional)
base theme (recommended)
hidden (optional)
engine (optional)
logo (optional)
screenshot (optional)
regions (optional)
regions_hidden (optional)
features (optional)
stylesheets-remove (deprecated)
ckeditor_stylesheets (optional)
因此您的主题信息文件只能具有这些属性。其他任何内容都将被忽略。
但是,drupal 8 允许主题和模块具有任意数量的自定义配置,这些配置可以通过配置架构系统加载。您可以使用它来定义所有其他设置。您可以从以下阅读更多相关信息