Hello Everyone,

This is my very first time using Drupal and I'm new to twig so I'm trying to figure this stuff out. I can't seem to find an answer to my problem though.

I'm using the foundation 6 framework and it has the logo as a list item in the menu. So I hard code the list item in the menu--main.html.twig but when I try to use {{ site_name }} or {{ site_slogan }} the values are null. I'm not sure why these are null because they work in the block--system-branding-block.html.twig file.

Could someone please take a moment to educate me, I'd appreciate it.

Thank you in advanced,
Carl

Comments

Jeff Burnz’s picture

Those variables are not available to menu templates, but you can get them from config in preprocess and make them available by setting them into a variable.

Not all variables are available universally (out of the box) in all templates, that would be mean a lot of pointless redundancy.

VanLuda’s picture

Thank you Jeff