为drupal 8中的区域创建单个模板文件

时间:2015-11-28 13:13:37

标签: php templates drupal twig drupal-8

我希望在一个Twig-File中使用页脚。

这些是我的地区:

regions:
  nav: Navigation
  content: Content
  content_top: 'Content Top'
  content_bottom: 'Content Bottom'
  front_one: 'Front One'
  front_two: 'Front Two'
  footer: Footer

我尝试在我的主题的模板文件夹中创建一个region--footer.html.twig文件,但这并不起作用。

有什么建议吗?

1 个答案:

答案 0 :(得分:0)

在drupal 8中的新模板指法后,我成功了:

在我的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中覆盖模板的正确方法

相关问题