Theming

Exercise: Override the Main Menu Template for Drupal 8, 9, 10, and 11

Last updated
Categories
Up-to-date with minor version
11.0.x

In this exercise, we'll practice theming by overriding the main menu template. We'll:

  • Override and rename the main menu template so that it will only affect the main menu component of our Drupal site.
  • Add Bootstrap classes from the base nav component into our overridden main menu template file.
  • Add CSS classes to HTML selectors using attributes.addClass() and set methods.

We recommend that you work on the exercise steps below first. You can refer to the video if you need some help.

Frontend Theming