Php 为drupal 8中的区域创建一个模板文件
例如,我希望在单个细枝文件中包含页脚 以下是我的区域:Php 为drupal 8中的区域创建一个模板文件,php,templates,drupal,twig,drupal-8,Php,Templates,Drupal,Twig,Drupal 8,例如,我希望在单个细枝文件中包含页脚 以下是我的区域: regions: nav: Navigation content: Content content_top: 'Content Top' content_bottom: 'Content Bottom' front_one: 'Front One' front_two: 'Front Two' footer: Footer 我尝试在主题的templates文件夹中创建region-footer.html.twi
regions:
nav: Navigation
content: Content
content_top: 'Content Top'
content_bottom: 'Content Bottom'
front_one: 'Front One'
front_two: 'Front Two'
footer: Footer
我尝试在主题的templates文件夹中创建region-footer.html.twig文件,但没有成功
有什么建议吗?在drupal 8中指点新模板之后,我成功地完成了: 在my page.html.twig的最底部:
{% if page.footer %}
{{ page.footer }}
{% endif %}
然后创建了一个region-footer.html.twig,其中包含以下内容:
{% if content %}
<div{{ attributes }}>
{{ content }}
</div>
{% endif %}
我从core/modules/system/templates/region.html.twig中得到了这个片段
我认为这是覆盖Drupal 8中模板的正确方法。请更详细地告诉我们您尝试了什么以及出现了什么/如何出错。Drupal使用的所有模板都被经典主题覆盖。建议您将其用作基本主题。