0

I'm trying to get started with sub theming in Drupal 8. I followed the example from the Drupal documentation and created what I thought was supposed to be an unmodified inherited copy of the Bartik theme, but the main navigation menu is changed per the below screenshots. My code is as follows, identical to the tutorial other than Bartik as the base theme.

What am I missing here? Why am I not starting with an identical layout to the Bartik theme?

info.yml:

name: wilmettewatch
type: theme
description: Wilmette Watch's theme based off Bartik for now
core: 8.x
# Defines the base theme
base theme: bartik
# Defines libraries group in which we can add css/js.
libraries:
  - wilmettewatch/global-styling
# Regions
regions:
  header: Header
  featured: Featured
  content: Content
  sidebar_first: First sidebar
  sidebar_second: Second sidebar
  footer: Footer

libraries.yml:

global-styling:
  css:
    component:
      css/style.css: {}

Bartik Theme:

Bartik Menus

My Sub Theme:

Broken Menus Screenshot

2
  • 2
    It's not recommended to extend Bartik. Extend Classy or Stable instead. See drupal.stackexchange.com/q/293773/15055
    – leymannx
    Commented May 22, 2020 at 19:46
  • Thanks, I'll do that. I assume I'll eventually migrate to Bootstrap or other theme, but good to know re: Bartik and tho other core themes. Commented May 23, 2020 at 1:18

1 Answer 1

2

The sub theme is fine. Sometimes when you activate a sub theme, you may need to recreate some or all of the block layout. In this case, the primary menu got placed in the header, where it gets a different layout.

Just make note of the block layout in the Bartik theme and duplicate it in the sub theme.

3
  • 3
    It's worth noting that this doesn't always hold true; if the parent theme is already enabled, is set as the default theme, and the subtheme contains matching regions, the block layout will be copied from the parent when the subtheme is enabled
    – Clive
    Commented May 22, 2020 at 18:42
  • Thanks, I will correct this! I'm just learning Drupal. However, I do believe my scenario met these criteria. I probably did something wrong. Commented May 23, 2020 at 1:14
  • Just found out it's also described at the beginning of drupal.org/docs/theming-drupal/adding-regions-to-a-theme
    – leymannx
    Commented Jun 24, 2020 at 21:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.