简体   繁体   English

Drupal 8手风琴菜单

[英]Drupal 8 Accordion menu

I just started to create my own Drupal 8 Theme , but I have no clue how to configure an accordion (side-)menu like here: 我刚刚开始创建自己的Drupal 8 Theme ,但是我不知道如何像下面这样配置手风琴(侧面)菜单:

https://www.w3schools.com/w3css/tryit.asp?filename=tryw3css_sidebar_accordion https://www.w3schools.com/w3css/tryit.asp?filename=tryw3css_sidebar_accordion

Any tips or tricks would help a lot. 任何提示或技巧都会有很大帮助。

(I'm not very familiar with Drupal 8 or JS) (我对Drupal 8或JS不太熟悉)

you can create theme region on the custom_theme.info.yml file: 您可以在custom_theme.info.yml文件上创建主题区域:

regions:
  sidebar_first: 'sidebar first'

Show menu on twig template (example: page.html.twig): 在树枝模板上显示菜单(例如:page.html.twig):

{% if page.sidebar_first %}
    {{ page.sidebar_first }}
  {% endif %}

Add menu to region : 将菜单添加到区域:

admin/structure/block: add block menu to sidebar first region

After custom css for menu. 自定义css后为菜单。

I think you read the documentation Adding Regions to a Theme 我认为您已阅读了将主题添加区域的文档

sounds like the part you are missing is how to add the accordion? 听起来您缺少的部分是如何添加手风琴? if so, take a look at Drupal 8 - creating an accordion field 如果是这样,请看一下Drupal 8-创建一个手风琴场

alternatively, other answers on that thread also mention modules to try. 或者,该线程上的其他答案也提到要尝试的模块。

if you find that you were just missing the piece on applying accordion styling, perhaps mark this question as a duplicate of that one? 如果您发现只是缺少应用手风琴样式的文章,也许将此问题标记为该问题的重复部分?

Drupal 8中有手风琴菜单 ,您可以尝试。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM