滚动
3.3. Panels, Page Manager - 页面输出构建器。创建主页。
我们之前已经学习过 Display Suite 模块,它允许我们将内容类型的输出组织为多列布局。
现在我们来了解 Page Manager 和 Panels 模块,它们不仅可以在列中显示内容类型,还可以在页面上添加额外的区块(blocks)。这对于网站主页尤其方便,因为主页通常需要展示各种新闻、博客、文章等内容的摘要。
让我们启用以下模块:Chaos Tools、Page Manager、Layout Plugin、Panels:
https://www.drupal.org/project/ctools
https://www.drupal.org/project/layout_plugin
https://www.drupal.org/project/panels
https://www.drupal.org/project/page_manager
与 Drupal 7 版本的 Panels 不同,Drupal 8/9/10 中的 Panels 不再自带 UI(用户界面),我们需要通过 Page Manager 模块来添加页面。此外,面板的主题化方式也发生了变化——现在我们使用 Layout Plugin 模块,它允许通过 YAML 文件定义布局插件。
在下一课中,我们将学习如何为面板添加自定义模板。目前,我们先使用 Panels 内置的多列布局模板。这样,我们就可以为内容定义不同的 CSS 样式,并通过管理界面进行配置。
关于为 Panels 创建新模板的官方文档: