0

I'm overriding a Twig template for the responsive_menu module, and encountering an issue with content not displaying.

The original Twig is named responsive-menu-horizontal.html.twig and my replacement is named block--responsive-menu-horizontal-menu.html.twig. Please note that the name of the replacement was derived from my Inspect Element debugger's suggestions.

The two Twig pages are almost exactly the same, save for the names and the added classes for the ul and li pieces

![1]: https://i.stack.imgur.com/T25DZ.png

When I use my override for the default Twig page, the nav completely disappears, and my debugger leaves me with this:

<!-- BEGIN OUTPUT from 'themes/indyres/templates/block/block--responsive-menu-horizontal-menu.html.twig' -->
<!-- END OUTPUT from 'themes/indyres/templates/block/block--responsive-menu-horizontal-menu.html.twig' -->

I'm confounded as to how it'll read my overriding template and render nothing. Any help/explanation is greatly appreciated, this is the first Drupal project I've ever worked on, and though I managed to keep my head above water in creating the styles for the rest of the site, this piece has me really lost.

  • Block templates are different than menu templates. – Kevin Jul 17 '18 at 19:04
  • That's what I thought, but my debugger, and even the previous template that was working, is under the block.html.twig. I tried changing it from block-- to menu-- and it just reverted to the previous template. – Cole Simchick Jul 17 '18 at 19:05
  • Ok, so the question is a bit confusing, but so is the responsive_menu module. The responsive_menu module implements a block plugin, which allows you to place things around. All blocks have a basic template like you see above block--responsive-menu-horizontal-menu.html.twig, but the responsive_menu module also implements additional template, theme wrappers in its render array (the PHP content that gets sent to the theme layer). So responsive-menu-horizontal.html.twig is a different template than your block. So the template replacement file name is incorrect for what you want to override. – mradcliffe Jul 18 '18 at 14:10
  • I probably can't make that an answer without additional details in the question about what you're trying to override exactly. – mradcliffe Jul 18 '18 at 14:10
0

After a lot of frustration, and realizing that I could (in fact) manage to get Superfish to do what I had originally wanted, I just composer remove'd the module and that's where it'll stay. Thanks for the help everybody!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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