-1

Drupal version: 8.8.2

Hello fellow Drupal devs, I am new to drupal, but have good experience in PHP.

Website is related to tiles. I am trying to do a project-specific custom theme. Having some issues in finding correct places to write code.

1) Firstly, Menu. I copied the menu.html.twig from core\themes\stable\templates\navigation and pasted in /themes/custom/themeName/templates/navigation. I have static HTML menu available, if I paste that HTML I can see what I need, but getting items from drupal menu, its items, links and placing them in my HTML is causing some issues. I have 3 level menu and different design for 2nd and 3rd levels. I don't see any logic for secondary menu other than,

    {% if item.below %}
      {{ menus.menu_links(item.below, attributes, menu_level + 1) }}
    {% endif %}

And this line {{ menus.menu_links(item.below, attributes, menu_level + 1) }} automatically generating some HTML, so where and how can I find and edit the HTML I need?

Any help is really appreciated.

New contributor
Mann is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
  • 1
    Welcome to Drupal Answers :) Please take some time to break these three separate questions out into individual posts, the Q+A format doesn't work so well when there are multiple unrelated question in a single post. Also please make sure you've read the official theming docs fully, as answers to the questions you've asked won't make sense without that underlying knowledge (for example, the concept of preprocessing for your third question). Many thanks! – Clive Mar 24 at 13:49
  • The key to understanding the menu twig is to realise that it uses a recursive macro. – stevekeiretsu Mar 25 at 2:02
  • It would probably help to also provide the markup that is undesirable in the question and enable twig debugging to find templates. – mradcliffe Mar 25 at 18:32